How to restart kwin when it is hung?

Solution 1:

As described in the official Kwin documentation, a good way to go would be to try this either on a running terminal application or on a virtual console (i.e.: Ctrl+Alt+F1), :

DISPLAY=:0 kwin --replace

Solution 2:

Similar to Robin Green's answer, but this does not require a terminal window to be open already. Instead, specify the display in which to start kwin from tty1. Hence,

Press Ctrl+Alt+F1 to access a terminal. Log in.

Type killall kwin. Then, type in DISPLAY=:0 kwin.

Press Ctrl+Alt+F7 to change back to your primary display.

Solution 3:

In later Kubuntu/Plasma 5 kwin still hangs/crashes (especially with Intel display drivers it seems), but can be more easily restarted: just run in krunner - Alt-Space, or Alt-F2: kwin --replace


Or, create a new custom shortcut for that: e.g. Trigger: Meta+K, Action, Command/URL: kwin --replace.

In this way kwin can be restarted with just the Meta-K shortcut.

Solution 4:

Press Ctrl+Alt+F1. Log in. Type killall kwin.

Press Ctrl+Alt+F7.

Quit all open applications until a terminal becomes visible. Hover the mouse over the terminal application. Type kwin &.

What's that, no terminal application open? Tough - you'll just have to reboot.