Is there a way to restart GNOME Shell other than by using Alt + F2, R + Enter?
With respect to the question, I have gone through Difference between `gnome-shell --replace` and r in Alt+F2, but I didn't get what I was looking for.
I am looking for a command which exactly does what Alt + F2, r + Enter do.
Please note that I am not willing to do the gnome-shell -- replace
command...
I did check both the things Alt + F2,r Enter and gnome-shell --replace
...
There is a lot of difference, I found...
The command for doing this is (Tested in Ubuntu 20.04 Only)
I also wanted to restart gnome shell programmatically because it seems there is some kind of memory leak in Ubuntu 19.10.
gnome-shell
starts consuming a little over 200 MB but after several hours of use it can reach more than 900 MB.alt+f2,r,enter
solves the problem gracefully. A small "restarting" message shows up. The change is almost unnoticeable, all windows maintain their position and running programs keep their state. Only the desktop background seems to flicker while it reloads.When using
gnome-shell --replace
some programs are killed with all the work in them lost, the windows that survive may change their position and several parts of the screen appear to be redrawn. I also triedkillall gnome-shell
with similar results.Unfortunately I don't think there is a way to access this functionality from the command line as it is embedded deep in the gnome-shell code for the RunDialog GObject:
gnome-shell > js > ui > runDialog.js [37]
As Diego F. Rodríguez V. mentioned, there is no way to access that from a terminal. However,
is very close and keeps your active session in tact. It sends a QUIT signal (SIGQUIT), and since gnome-shell is set to start automatically whenever X is up, it technically does a similar thing.
can be done as well, but it requires a PID (process ID) as an argument, which can be found via