In this short guide, we go to see how to restart GNOME Shell from the terminal avoiding the closure of applications on X11. GNOME Shell, the basis of Ubuntu after the farewell to Unity, can be restarted without closing the app only on X11. If you use Wayland, in fact, the session is restarted but the applications will also close. If instead it is working properly and is not a crashed without closing the app restart may be performed by giving Alt + F2 then r and pressing the button Enter.
Restart GNOME Shell from the command line: three ways
But what if you want to restart GNOME Shell from the command line without closing all applications? It can be useful to have a script available to accomplish this task or set a keyboard shortcut so that you can restart GNOME Shell in case it crashes/does not respond, etc.
busctl --user call org.gnome.Shell /org/gnome/Shell org.gnome.Shell Eval s 'Meta.restart("Restarting…")'
If for some reason this instruction does not work, an alternative is the following:
killall -HUP gnome-shell
However, the latter command keeps some applications running, but others are closed. Also, if used too frequently, GNOME Shell may detect that something has gone wrong and disable all extensions. So it's not perfect and that's why I don't recommend using it unless it's strictly necessary. HUP is a signal which is interpreted as a request for restart and re-configuration.
One last possibility, which however concerns only the release 3.28 and previous versions (is there someone who still uses them?), Consists in launching gnome-shell --replace. With GNOME Shell 3.30 and above this shortcut does not work, on the contrary, it causes GNOME to crash and logout will be forced from the session.
0 Comments