diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED NO_MODULE COMPONENTS DBus Gui Qml Quick) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS - Activities Archive CoreAddons Crash DBusAddons Declarative GlobalAccel I18n + Activities Archive CoreAddons GuiAddons Crash DBusAddons Declarative GlobalAccel I18n IconThemes NewStuff Notifications Plasma PlasmaQuick Wayland WindowSystem XmlGui) find_package(X11 REQUIRED) diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ KF5PlasmaQuick >= 5.38.0 KF5Activities >= 5.38.0 KF5CoreAddons >= 5.38.0 + KF5GuiAddons >= 5.38.0 KF5DBusAddons >= 5.38.0 KF5Declarative >= 5.38.0 KF5Wayland >= 5.38.0 diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -54,6 +54,7 @@ KF5::DBusAddons KF5::Declarative KF5::CoreAddons + KF5::GuiAddons KF5::GlobalAccel KF5::Archive KF5::Crash diff --git a/app/globalshortcuts.h b/app/globalshortcuts.h --- a/app/globalshortcuts.h +++ b/app/globalshortcuts.h @@ -29,6 +29,9 @@ #include #include +// KDE +#include + namespace Plasma { class Containment; } @@ -82,6 +85,9 @@ QList m_methodsShowNumbers; Latte::Corona *m_corona{nullptr}; + + KModifierKeyInfo m_keyInfo; + QTimer m_mKeyInfoTimer; }; } diff --git a/app/globalshortcuts.cpp b/app/globalshortcuts.cpp --- a/app/globalshortcuts.cpp +++ b/app/globalshortcuts.cpp @@ -273,6 +273,19 @@ m_singleMetaAction = new QAction(this); m_singleMetaAction->setShortcut(QKeySequence(Qt::META)); + + //display shortcut badges while holding Meta + m_mKeyInfoTimer.setInterval(1000); + connect(&m_mKeyInfoTimer, &QTimer::timeout, this, [&]() { + showDocks(); + }); + connect(&m_keyInfo, &KModifierKeyInfo::keyPressed, this, [&](Qt::Key key, bool state) { + if (key == Qt::Key_Super_L && state) { + m_mKeyInfoTimer.start(); + } else if (key == Qt::Key_Super_L && !state) { + m_mKeyInfoTimer.stop(); + } + }); } //! Activate launcher menu through dbus interface @@ -563,6 +576,10 @@ void GlobalShortcuts::showDocks() { m_lastInvokedAction = dynamic_cast(sender()); + if (!m_lastInvokedAction) { + // when holding Meta + m_lastInvokedAction = m_singleMetaAction; + } auto invokeShowNumbers = [this](const Plasma::Containment * c) { if (QQuickItem *containmentInterface = c->property("_plasma_graphicObject").value()) {