Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly start a Gnome-Shell extension via command line?

After copying [email protected] folder to .../gnome-shell/extensions/ I'm executing this command on the terminal:

gnome-shell-extension-tool -e [email protected]

Then, I restart my session with Alt + F2 and execute r, and everything works fine.

But can I start my extension only through the command line? Without Alt+F2+r? Without restarting my gnome-shell session?

like image 562
GusMilky Avatar asked Oct 04 '17 12:10

GusMilky


People also ask

How do I enable GNOME Shell?

Press Alt+F2 and enter r to restart GNOME Shell.


2 Answers

According to some answers around the internet, sending SIGHUP to the gnome-shell process restarts it (i. e. killall -HUP gnome-shell), but I haven’t been able to find a clear source on this and couldn’t find the signal handling in the code. What I do know is that this should be exactly equivalent to Alt+F2 r:

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

Because apart from a gettext call on the message, this is exactly what Alt+F2 r is bound to (see runDialog.js – search for _restart).


January 2022 update: Since Gnome 41, calling Eval is restricted and requires “unsafe mode” to be enabled, so by default this will no longer work. I’m not currently aware of a replacement for this particular usage.

like image 183
Lucas Werkmeister Avatar answered Sep 28 '22 02:09

Lucas Werkmeister


Personally, I prefer a solid Alt+F2, r+Enter but maybe try disabling and enabling:

gnome-shell-extension-tool -d [email protected] && gnome-shell-extension-tool -e [email protected]

or

gnome-shell-extension-tool -r [email protected]

Which may do the same thing. There's also gnome-shell-extension-prefs which you can use to do the same thing (and is typically hidden in Gnome for some reason).

like image 40
andy.holmes Avatar answered Sep 28 '22 01:09

andy.holmes