9

After copying myexentension@me.com folder to .../gnome-shell/extensions/ I'm executing this command on the terminal:

gnome-shell-extension-tool -e myexentension@me.com

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?

3 Answers 3

15

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.

5
  • This is exactly what i need. killall also killed my browser for some reason
    – WuerfelDev
    May 2, 2020 at 21:33
  • @maxschlepzig I don’t see why it shouldn’t… Nov 17, 2020 at 17:36
  • @LucasWerkmeister because Alt+F2 r doesn't work under Wayland ... Nov 17, 2020 at 17:40
  • Oh, right. Well, I just tried it out, and it looked like it did something and there was no obvious error message. (But the same is true when I run Alt+F2 r, so maybe that’s supported since a recent Gnome version? I’m on 3.38.) Nov 17, 2020 at 18:28
  • @LucasWerkmeister regarding your concerns, the solution is in askubuntu.com/a/1376953/598062 . You might like to update your answer with this information. Aug 26, 2022 at 8:46
8

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

gnome-shell-extension-tool -d myexentension@me.com && gnome-shell-extension-tool -e myexentension@me.com

or

gnome-shell-extension-tool -r myexentension@me.com

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).

4
  • Thanks Andy. But it doesn't update my extension without Alt + F2, r+Enter or restarting my system. If the extension is already installed, I found a command on Gnome DBus to update it. But if it's the first time how can I show the extension without restarting my session? I can't find a way to restart the session using the command line. If I use gnome-shell --replace I get a strange behavior if I close the terminal.
    – GusMilc
    Oct 26, 2017 at 13:46
  • True, as far as I know Alt+F2, r+Enter is the only way to cleanly do it. I wouldn't worry about it much, and just do it that way. Oct 26, 2017 at 15:44
  • @andy.holmes - Alt+F2, R Enter simply doesn't work if Gnome-Shell is running under Wayland ... Nov 16, 2020 at 15:24
  • Correct, you have to restart the session if running under Wayland. Nov 17, 2020 at 0:58
2

gnome-shell-extension-tool is deprecated, use gnome-extensions instead. The command is:

gnome-extensions reset window-calls@domandoman.xyz && gnome-extensions enable window-calls@domandoman.xyz

If that does not work then try

killall -3 gnome-shell  

I have a .desktop file that looks like:

[Desktop Entry]
Type=Application
Terminal=true
Name=Restart Gnome
Icon=utilities-terminal
Exec=killall -3 gnome-shell
Categories=Utility;

I added it to the panel and just click the button when working on gnome extensions.

The official documentation for debugging and logging gnome extensions is here.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.