27 C
Jaipur
Friday, October 23, 2020

How To Restart GNOME Shell From Command Line Without Closing Any Applications (X11 Only)

Must read

How To Create A Custom Ubuntu Live ISO Image With Cubic

One of the major advantage of Linux is you can customize it however you like. You can add a new feature, remove an existing...

Amazon sale: Top deals on mirrorless cameras from Sony, Fujifilm, Olympus and others

Ahead of the festive season if you are looking to buy an affordable mirrorless camera then there are some good deals available on Amazon...

10 Best MagSafe Accessories for iPhone 12 Pro Max

During the iPhone 2020 event, Apple resurrected MagSafe and brought the abandoned tech to the iPhone 12 series. Apple is hoping to create a...

This article explains how to restart GNOME Shell from the command line, without closing any applications (X11 only).

GNOME Shell can be restarted without closing all applications only on X11 (used by default on Ubuntu for example); under Wayland (which is what Fedora uses by default for example), GNOME Shell is the display server, and if the display server goes down, all running applications go down as well, so this doesn’t work. If you use this under Wayland, the session is restarted, closing all running applications.

I assume you already know that while GNOME Shell is running (it hasn’t crashed), you can restart it and keep all running applications by pressing Alt + F2, then type r and press the Enter key.

But what if you want to restart GNOME Shell from the command line without closing all applications? This can be useful in a script, or attach the command to a keyboard shortcut so you can restart GNOME Shell in case it freezes / becomes unresponsive, etc.

The command-line equivalent of pressing Alt + F2 and then typing r is the following (so this command restarts GNOME Shell without closing any running applications):

busctl --user call org.gnome.Shell /org/gnome/Shell org.gnome.Shell Eval s 'Meta.restart("Restarting…")'

This is a single command – triple click the line to select it.

Since this is what GNOME Shell does when running Alt + F2 and typing r, this is the best way of restarting GNOME Shell from the command line. h/t Lucas Werkmeister for this command.

In case this doesn’t work for some reason, another command that should restart GNOME Shell is:

killall -HUP gnome-shell

This keeps some running applications, but others are closed. Also, if you keep running this, GNOME Shell might detect that something went wrong and disable all your extensions, logging you out in the process. So this command is not perfect, that’s why I don’t recommend using it unless you really have to.

So what does this HUP signal do? This is sent to a program to request it to restart and re-read its configuration.

Another way of restarting GNOME Shell that only works with GNOME Shell 3.28 and older, is to run gnome-shell --replace. This no longer works properly with GNOME Shell 3.30 and newer – if you try in such a case, it will crash GNOME Shell, forcing you to logout.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How To Create A Custom Ubuntu Live ISO Image With Cubic

One of the major advantage of Linux is you can customize it however you like. You can add a new feature, remove an existing...

Amazon sale: Top deals on mirrorless cameras from Sony, Fujifilm, Olympus and others

Ahead of the festive season if you are looking to buy an affordable mirrorless camera then there are some good deals available on Amazon...

10 Best MagSafe Accessories for iPhone 12 Pro Max

During the iPhone 2020 event, Apple resurrected MagSafe and brought the abandoned tech to the iPhone 12 series. Apple is hoping to create a...

Google Chrome May Soon Add Shopping Ads on New Tab Page

Google’s primary source of income, as you all might be aware, is through advertisements. In a move that could potentially scale up the company’s...