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.

qdbus
qdbus org.kde.kglobalaccel
qdbus org.kde.kglobalaccel /component/plasmashell
qdbus org.kde.kglobalaccel /component/plasmashell shortcutNames | sort
qdbus org.kde.kglobalaccel /component/plasmashell invokeShortcut "activate widget 56"

In order to determine which widget id (56) you need, check ~/.config/plasma-org.kde.plasma.desktop-appletsrc.

grep windowlist -B5 ~/.config/plasma-org.kde.plasma.desktop-appletsrc

Eg:

$ grep sysmonitordash -B5 ~/.config/plasma-org.kde.plasma.desktop-appletsrc
deviceId=aaaaaaaaaaaaaaaa
deviceName=Motorola Moto G

[Containments][1][Applets][56]
immutability=1
plugin=com.github.zren.sysmonitordash

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:

qdbus org.kde.kglobalaccel /component/plasmashell

to find all the functions and their namespaces for the /component/plasmashell path.

property read QString org.kde.kglobalaccel.Component.friendlyName
property read QString org.kde.kglobalaccel.Component.uniqueName
...
method void org.kde.kglobalaccel.Component.invokeShortcut(QString shortcutName)
...

So invokeShortcut’s namespace is org.kde.kglobalaccel.Component

kwriteconfig5 --file ~/.config/kwinrc --group ModifierOnlyShortcuts --key Meta "org.kde.kglobalaccel,/component/plasmashell,org.kde.kglobalaccel.Component,invokeShortcut,activate widget 56"
qdbus org.kde.KWin /KWin reconfigure

Since the , is the separator, we didn’t need to wrap activate widget 56 in quotes as spaces are no longer the separator.