On my Fedora KDE machine, I use KRunner instead of the Application Menu to launch programs, since it can also do other stuff like executing commands, calculating expressions, etc., which is quite convenient.

Previously on Plasma 5.16, setting Meta key shortcut to org.kde.kglobalaccel,/component/krunner,,invokeShortcut,run command in kwinrc is enough to make KRunner toggleable using Meta key. However, this doesn’t work anymore in Plasma 5.17. KRunner can now only be opened with Meta key if we set the shortcut to org.kde.krunner,/App,,display. Wanna close it? Reach to the Esc key.

I was stuck with this for some days, until this morning I just looked through my bookmark collection with no real purpose and saw the title “KDE 5.17: KRunner or KRunner_Desktop ?” of a Reddit post 5 months ago. And…

The solution is:

  • Install xdotool
  • Copy the guy’s code to make a bash script
krunnerWindow=$(xdotool getwindowfocus getwindowname)
if [[ $krunnerWindow == *"krunner"* ]]; then
    xdotool key 'Escape'
    exit 0
    qdbus org.kde.krunner /App display
    exit 0
  • Create a custom global shortcut:
    • System Settings > Shortcuts > Custom Shortcuts > Edit > New > Global Shortcut > Command/URL
    • Point to the bash script in the new shortcut’s Action tab
  • Open ~/.config/khotkeysrc, find the UUID of the new shortcut
  • Set Meta key shortcut in kwinrc to org.kde.kglobalaccel,/component/khotkeys,org.kde.kglobalaccel.Component,invokeShortcut,<UUID> (the UUID includes the curly brackets)

Maybe I should get the newest KDE software instead of going with what Fedora maintainers give me, so that I’m not so far behind online discussions.