Activate any widget with Meta key
A user on reddit recently asked how to trigger any widget using the Meta key.
The Meta key “shortcut” works by KWin detecting the keypress and sending a DBus signal to another process (plasmashell
or latte-dock
). I believe this is necessary since the Qt keyboard shortcut “Actions” do not support modifier only shortcuts, and the only way to add support for it would be to patch Qt upstream or fork Qt and rewrite every KDE app using that fork of Qt (like KDE4 did?).
Technically, we can have it trigger a widget using a qdbus org.kde.kglobalaccel ...
command.
In order to determine which widget id (56
) you need, check ~/.config/plasma-org.kde.plasma.desktop-appletsrc
.
Eg:
In order to assign the [ModifierOnlyShortcut]
in kwinrc
, you need to turn the command into a StringList. Replace the spaces between arguments with a comma ,
. We also need the invokeShortcut
method’s namespace, which we normally can normally leave it out when running qdbus
from the terminal since there usually isn’t a name conflict. First run the following command:
to find all the functions and their namespaces for the /component/plasmashell
path.
So invokeShortcut
’s namespace is org.kde.kglobalaccel.Component
Since the ,
is the separator, we didn’t need to wrap activate widget 56
in quotes as spaces are no longer the separator.