11

Is it possible to install an extension from https://extensions.gnome.org/ without using GNOME Shell integration browser add-on?

I'm looking for a tool that will be able to search and install extensions from the above web-site, for example:

$ gnome-extensions search <keyword>
$ gnome-extensions install <extension-id>

5 Answers 5

9

Solution 1:

If you have the extension urls then use the following. Here, I have put the extensions in an array. Place the URLs of the extensions you want to install in this array.

#!/bin/bash

array=( https://extensions.gnome.org/extension/1328/disable-workspace-switch-animation/
https://extensions.gnome.org/extension/1532/lock-keys/
https://extensions.gnome.org/extension/104/netspeed/
https://extensions.gnome.org/extension/2182/noannoyance/
https://extensions.gnome.org/extension/1460/vitals/ )

for i in "${array[@]}"
do
    EXTENSION_ID=$(curl -s $i | grep -oP 'data-uuid="\K[^"]+')
    VERSION_TAG=$(curl -Lfs "https://extensions.gnome.org/extension-query/?search=$EXTENSION_ID" | jq '.extensions[0] | .shell_version_map | map(.pk) | max')
    wget -O ${EXTENSION_ID}.zip "https://extensions.gnome.org/download-extension/${EXTENSION_ID}.shell-extension.zip?version_tag=$VERSION_TAG"
    gnome-extensions install --force ${EXTENSION_ID}.zip
    if ! gnome-extensions list | grep --quiet ${EXTENSION_ID}; then
        busctl --user call org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions InstallRemoteExtension s ${EXTENSION_ID}
    fi
    gnome-extensions enable ${EXTENSION_ID}
    rm ${EXTENSION_ID}.zip
done

Solution 2:

If you have the UUID of the extensions, then use the following. Here, I have put the UUIDs in an array. Place the UUIDs of the extensions you want to install in this array.

#!/bin/bash

array=( [email protected] lockkeys@fawtytoo [email protected] [email protected] [email protected] )

for i in "${array[@]}"
do
    VERSION_TAG=$(curl -Lfs "https://extensions.gnome.org/extension-query/?search=${i}" | jq '.extensions[0] | .shell_version_map | map(.pk) | max')
    wget -O ${i}.zip "https://extensions.gnome.org/download-extension/${i}.shell-extension.zip?version_tag=$VERSION_TAG"
    gnome-extensions install --force ${EXTENSION_ID}.zip
    if ! gnome-extensions list | grep --quiet ${i}; then
        busctl --user call org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions InstallRemoteExtension s ${i}
    fi
    gnome-extensions enable ${i}
    rm ${EXTENSION_ID}.zip
done

Bonus (Cinnamon):

If you are using Linux Mint (Cinnamon) by any chance then you can use the following script. It download the extensions and put them in proper directory.

#!/bin/bash

array=( https://cinnamon-spices.linuxmint.com/applets/view/83
    https://cinnamon-spices.linuxmint.com/applets/view/106
    https://cinnamon-spices.linuxmint.com/applets/view/222
    https://cinnamon-spices.linuxmint.com/applets/view/238
    https://cinnamon-spices.linuxmint.com/applets/view/284
    https://cinnamon-spices.linuxmint.com/applets/view/303 )

for i in "${array[@]}"
do
    DOWNLOAD_URL=$(curl -Lfs ${i} | grep -m1 -Po '(?<=href=")[^"]*zip')
    FILE_NAME=$(echo $DOWNLOAD_URL | grep -Eo "([^\/]+$)")
    wget $DOWNLOAD_URL
    unzip -o "$FILE_NAME" -d "$HOME/.local/share/cinnamon/applets"
    rm "${FILE_NAME}"     
done

You might have noticed that the extensions are not enabled yet. This is because you need to add something like the following line after done.

gsettings set org.cinnamon enabled-applets "['panel1:left:0:[email protected]:0', 'panel1:left:1:[email protected]:1', 'panel1:left:2:[email protected]:2', 'panel1:right:4:[email protected]:3', 'panel1:right:6:[email protected]:4', 'panel1:right:7:[email protected]:5', 'panel1:right:8:[email protected]:6', 'panel1:right:9:[email protected]:7', 'panel1:right:10:[email protected]:8', 'panel1:right:11:[email protected]:9', 'panel1:right:12:[email protected]:10', 'panel1:right:13:[email protected]:11', 'panel1:right:14:[email protected]:12', 'panel1:right:15:[email protected]:13', 'panel1:right:16:[email protected]:14', 'panel1:right:3:temperature@fevimu:15', 'panel1:right:2:download-and-upload-speed@cardsurf:16', 'panel1:right:17:betterlock:17', 'panel1:right:5:turn-off-monitor@zablotski:18']"

The value of enabled-applets varies from user to user. It is used to enable the applets.

Now i will show you how to create this string. After you have placed the extensions in $HOME/.local/share/cinnamon/applets (using the bonus script), go to System Settings > Preferences > Applets and add them to panel. If you want to rearrange the applets in the panel using Panel edit mode, then please go ahead and do it. Now run:

gsettings get org.cinnamon enabled-applets

From now on you can use the string in gsettings set org.cinnamon enabled-applets. However, note that every time you add or remove an applet to the panel, or move position of an applet in the panel, the string is changed.

1
  • I'm thankful for your detailed answer with built-in commands. I do have a question. In Solutions 1&2, why do you download the extension file and fall back to the dbus InstallRemoteExtension call? InstallRemoteExtension is what the browser extension calls--it downloads and installs an extension in one call. Solution 1's for loop should be able to shrink down to 2 lines: Grab the UUID, then call DBUS with that UUID. Solution 2's for loop then becomes that one DBUS call. You've inspired me to make a function that merges the 2 solutions, taking a URL or UUID then installing it.
    – Cliff
    Nov 22, 2023 at 15:25
7

GNOME Shell Extension Installer is what you are looking for: https://github.com/brunelli/gnome-shell-extension-installer

Screenshot

1
  • 1
    It is archived and does not work as of March 2023
    – dimisjim
    Sep 20, 2023 at 11:00
2

I could not comment on Ahmad Ismail's post above, so I'm updating here. I spend some time with this and was partially successful and saying partially as unfortunately there is no way of installing extension from https://extensions.gnome.org/ without user interaction. Ahmad Ismail's script was working, but needed some correction, as it download the file using wget and installs using dbus (which again downloads and installs from extensions.gnome.org). There have also been some changes in https://extensions.gnome.org/ which resulted in query different from what the script expects. Based on Ahmed Ismail's script, I have created 2 different versions. Note both are using UUID.

1. Using dbus

  • Cons: Requires user interaction to confirm installation on a message-dialog for each extension.
  • Pros: Doesn't require restarting of gnome-shell.

This method need a user interaction to confirm installation, using message-dialog. This would be useful, for installing extension in batches.

#!/bin/bash

EXT_LIST=(
[email protected]
blur-my-shell@aunetx
[email protected]
freon@UshakovVasilii_Github.yahoo.com
)

for i in "${EXT_LIST[@]}"
do
    busctl --user call org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions InstallRemoteExtension s ${i}
done

2. Download from website using wget and install using gnome-extensions

  • Pros: Does not require user interaction.
  • Cons: Requires restarting of gnome-shell.

This method will install extension, but it won't enable or show up in extension app until user restarts gnome-shell (wayland:logout/login | Xorg:Alt+F2). This is useful when you install a Linux distro and you have made a script to update and install all your libs/software and are planning to restart the system after installation of apps and updates are completed. This is why I needed it.

#!/bin/bash

EXT_LIST=(
[email protected]
blur-my-shell@aunetx
[email protected]
freon@UshakovVasilii_Github.yahoo.com
)

GN_CMD_OUTPUT=$(gnome-shell --version)
GN_SHELL=${GN_CMD_OUTPUT:12:2}
for i in "${EXT_LIST[@]}"
do
    VERSION_LIST_TAG=$(curl -Lfs "https://extensions.gnome.org/extension-query/?search=${i}" | jq '.extensions[] | select(.uuid=="'"${i}"'")') 
    VERSION_TAG="$(echo "$VERSION_LIST_TAG" | jq '.shell_version_map |."'"${GN_SHELL}"'" | ."pk"')"
    wget -O "${i}".zip "https://extensions.gnome.org/download-extension/${i}.shell-extension.zip?version_tag=$VERSION_TAG"
    gnome-extensions install --force "${i}".zip
    rm ${i}.zip
done

Hope this helps anyone who is looking for this.

Again credit goes to Ahmad Ismail for the script posted https://unix.stackexchange.com/a/707840/593003

0
1

I've recently come across gnome-extensions-cli, which seems to have been around for some time, but has only recently gained new activity (see Code frequency of the project). I think it's a great tool, it produces beautiful output, and it's also script-friendly.

The CLI lets you search, install, upgrade, enable and list GNOME extensions, among other things. You can pass the extension's UUID or its package number.

The tool gnome-shell-extension-installer suggested by @WuerfelDev doesn't seem to be maintained any longer, as of April 2023.

-2

EDIT: After trying to actually use this tool in my own installation scripts, I quickly realized that this tool only allows managing the extensions which are already installed on your device.

This is very confusing to me, because the list of available sub-commands look very "package manager"-like, but don't actually integrate with the "repository" at https://extensions.gnome.org/.

Since there are other third-party tools available that do exactly that (as posted in the other answers here), there must be endpoints that allow querying and downloading the extensions from there. So it's strange to me that this functionality hasn't been added to the already existing CLI tool.

This answer is basically useless now, but I'll leave this explanation here, just if anyone stumbled upon this and got very confused like I did.


Since GNOME 34 gnome-shell provides the gnome-extensions command-line tool. On Fedora 38 it came already bundled, so there was no separate installation necessary. I would assume it's the same for other distros.

$ gnome-extensions
Usage:
  gnome-extensions COMMAND [ARGS…]

Commands:
  help      Print help
  version   Print version
  enable    Enable extension
  disable   Disable extension
  reset     Reset extension
  uninstall Uninstall extension
  list      List extensions
  info      Show extension info
  show      Show extension info
  prefs     Open extension preferences
  create    Create extension
  pack      Package extension
  install   Install extension bundle

Use “gnome-extensions help COMMAND” to get detailed help.

source

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .