Writing a kquitapp5 killall kstart5 alias script for Plasma and KWin

In the early Gnome 3 days, I remember when Gnome’s performance began to degrade due to leaky memory bugs, there was a feature where you pull up the app launcher with Alt + F2 and type: ‘r’ and press the Enter key, which would restart the window manager, flushing the cache so to speak. I haven’t used Gnome 3 in years and I am not sure if they still have that feature.

Anyways, there is a shell command that Plasma users can invoke for the same purpose. On the askubuntu Stack Exchange forum, there is a popular answer which explains exactly how to do this for KDE > 5.10:

$ kquitapp5 plasmashell || killall plasmashell && kstart5 plasmashell

I tried it. It works.

To take this to the next level, how do I create a shortcut / alias to emulate the simple keystroke feature from Gnome 3 that I described initially? I’m not really sure where to begin. Like, I understand that the script would be fairly basic and only really need to be a few lines long with the main command being: kquitapp5 plasmashell || killall plasmashell && kstart5 plasmashell but how would I tell the script to trigger when a user enters ‘r’ in the Alt + F2 dialog? How would I establish that hook or connection between when the user enters the ‘r’ alias in Plasma’s Alt + F2 dialog which would send a signal to trigger a bash/zsh script?

Just use Alt+F2 plasmashell --replace.

Thank you for your answer. plasmashell --replace is a good alternative, but my goal is to make it even simpler and easier by using an alias for KRunner so I just need to type 'r' + Enter.

There’s an easier way:
Assign a shortcut to plasmashell --replace, e.g. Ctrl + Alt + R, using System Settings:

This way you won’t have to enter anything in KRunner, just press a couple of keys.

Eureka! This works so much better. Thank you, @openminded :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.