gnome-shellgnome-shell-extensions

How does gnome-browser-extension and chrome-gnome-shell load extension without reloading gnome session


gnome-extensions man page says:

The command unpacks the extension files and moves them to the expected location in the user’s $HOME, so that it will be loaded in the next session.

so to install netspeed extension via script, we have to do something like:

#!/bin/bash

gnome-extensions install --force netspeed@hedayaty.gmail.com.zip
killall -HUP gnome-shell
sleep 5s
gnome-extensions enable

Please check How to properly start a Gnome-Shell extension via command line? for more details.

But the thing is, if we use gnome-browser-extension and chrome-gnome-shell to install extensions from https://extensions.gnome.org/ , then it does not reload the gnome session. It just smoothly gets the work done.

I want to improve my script on Command line tool to install GNOME Shell extensions. If i can implement the same mechanism to install extension without reloading gnome session then my script will be more polished. This is the context of this question.

So, how does gnome-browser-extension and chrome-gnome-shell load extension without reloading gnome session?


Solution

  • To install gnome extensions without reloading the gnome session, you have to run:

    busctl --user call org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions InstallRemoteExtension s ${EXTENSION_ID}
    

    or,

    dbus-send --session --type=method_call --print-reply --dest=org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions.InstallRemoteExtension string:${EXTENSION_ID}