Show desktop with Meta key in Kubuntu

Simply typing in desktop view in Plasma brings forth Krunner ­with the already typed search. This (not very popular) feature is excellent in my opinion and makes the desktop act like an application launcher.

Because I am conditioned to use Meta for the application launcher, I’d like to associate this key to "Show desktop" action (or a widget to that effect).


The only things I miss in Krunner compared to the Application launcher are the favorites and the recent files, but:

  • Krunner can be run by directly typing while in desktop view, and the desktop can show

    • Favorite apps – by adding them by adding Quicklauncher widget to the desktop for example

    • Recent files – with the "Folder view" widget

All I want now is to associate Meta key with the widgets that show the desktop or with the "Show desktop" action:

enter image description here

But the Alt+F1 shortcut doesn’t equate to using Meta, maybe for the reasons said here. The OP there said here that the key can be remapped, but I don’t know how to do that.

Asked By: cipricus

||

Source: Activate any widget with Meta key

kwriteconfig5 --file ~/.config/kwinrc --group ModifierOnlyShortcuts --key Meta "org.kde.kglobalaccel,/component/plasmashell,org.kde.kglobalaccel.Component,invokeShortcut,activate widget <WIDGET_ID_NUMBER>"

qdbus org.kde.KWin /KWin reconfigure

So, before running the first command, you need to know the widget’s ID number, for example, here, the ID of the "Minimize All Windows" widget, which must be already added to the desktop/panel.

In order to determine which widget ID you need, check ~/.config/plasma-org.kde.plasma.desktop-appletsrc. There I see:

[Containments][2][Applets][21]
immutability=1
plugin=org.kde.plasma.minimizeall

The ID of "Minimize All Windows" widget is 21 (that varies).

(For some reason I couldn’t find in the same way the reference of "Peek at desktop". It might be based on the previous one, I don’t know.)

So:

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

then:

qdbus org.kde.KWin /KWin reconfigure

To revert that, edit ~/.config/kwinrc and remove the group ModifierOnlyShortcuts and its Meta setting.

Answered By: cipricus