Search

Gnome Shell - Command line Installation of Extensions from http://extensions.gnome.org

Contents[Hide]

dropcap-gnome-shell

This article is obsolete and been completly rewritten.
It is available at Gnome Shell - Management of Extensions from console

Under Debian or Ubuntu, Gnome Shell comes with very few extensions provided by the default installation.

Some extensions are provided by some extra packages, but the main collection of extensions is available from Gnome Shell Extensions repository website.

But at the time of this article, you need to install them one by one from the extension pages of the site. There is no way to install them in console mode.

This is quite annoying if you are a sysadmin and you are handling quite a big amount of workstations. You then need to script all these installation and configuration procedures.

This article explains how to retrieve, install & enable Gnome Shell extensions from https://extensions.gnome.org/ via some console commands.

It also provides a script that does all the installation steps in one go. With this script, you'll be able to fully automate the installation of your favorite Gnome Shell extensions from https://extensions.gnome.org/.

It has been tested under Ubuntu Precise 12.04 & Gnome Shell 3.4, but it should work on any Ubuntu or Debian flavour and with latest Gnome Shell versions.

1. Step by step Installation

For this step-by-step guide, we will install the Remove Accessibility extension available from https://extensions.gnome.org/extension/112/remove-accesibility/.

1.1. Determine Extension ID

If you want to install a Gnome Shell Extension thru command line, first step is to determine the extension ID.

This can be done easily from the Gnome Shell Extensions site. The extension ID is part of the description page URL, just after the /extension/ part.

For example, Remove Accessibility URL is https://extensions.gnome.org/extension/112/remove-accesibility/, so ID is 112.

1.2. Get Extension Parameters

Next, you need to get your extension parameters from the Gnome Shell Extension site.

The extension parameters are depending on 2 variables :

  • extension ID
  • Gnome Shell version

The full parameters are available from a specific URL built-up following this model :

https://extensions.gnome.org/extension-info/?pk=extension-id&shell_version=gnome-shell-version

For example, for Remove Accessibility under Gnome Shell 3.4 you get parameters from https://extensions.gnome.org/extension-info/?pk=112&shell_version=3.4

https://extensions.gnome.org/extension-info/?pk=112&shell_version=3.4

{"shell_version_map": {"3.6": {"pk": 2847, "version": 15}, "3.4": {"pk": 2847, "version": 15}, "3.2": {"pk": 2847, "version": 15}, "3.8": {"pk": 2847, "version": 15}}, "description": "Remove the accessibility button from the top panel.", "creator": "lomegor", "version_tag": 2847, "name": "Remove Accessibility", "version": 15, "link": "/extension/112/remove-accesibility/", "download_url": "/download-extension/removeaccesibility@lomegor.shell-extension.zip?version_tag=2847", "pk": 112, "creator_url": "/accounts/profile/lomegor", "icon": "/static/extension-data/icons/icon_112_1.png", "uuid": "removeaccesibility@lomegor"}

Important parameters are :

  • download_url : this is the URL to retrieve the extension archive
  • uuid : this is the extension unique identifier

1.3. Install Extension

Now that you know archive URL and extension UUID, you can download the extension and install it.

Extension is downloaded from the download_url.

It can be installed at 2 places :

  • on a per-user basis in ~/.local/share/gnome-shell/extensions/extension-uuid/
  • on a system wide basis in /usr/share/gnome-shell/extensions/extension-uuid/

On a user basis, we need to do :

# wget -O /tmp/extension.zip "https://extensions.gnome.org/download-extension/removeaccesibility@lomegor.shell-extension.zip?version_tag=2847"
# mkdir -p "$HOME/.local/share/gnome-shell/extensions/removeaccesibility@lomegor"
# unzip /tmp/extension.zip -d "$HOME/.local/share/gnome-shell/extensions/removeaccesibility@lomegor"

1.4. Enable Extension

Last step is to enable the extension under Gnome Shell Settings.

This can be done thru command line in 2 steps :

  1. list installed extensions
  2. declare these extensions + the new one

# gsettings get org.gnome.shell enabled-extensions
['weather-extension@xeked.com', 'axemenu@wheezy']
# gsettings set org.gnome.shell enabled-extensions "['weather-extension@xeked.com', 'axemenu@wheezy', 'removeaccesibility@lomegor']"

Extension is now enabled in Gnome Shell.

1.5. Restart Gnome Shell

But you need to restart Gnome Shell for the new extension to be detected.

This can be done from your Gnome Shell environment by typing ALT F2 and then r.

It can also be done via a console with :

# gnome-shell --replace &

Don't forget the & at the end of the line.
If you forget it, you will loose your terminal prompt !

2. Automatic Installation Script

The following shell-extension-install script handles all previous operations.

It takes 2 parameters :

  • Gnome Shell version (3.4, 3.6, ...)
  • Extension ID

In case the extension you ask for is not available for the specific Gnome Shell version, you'll get an error message.

/usr/local/sbin/shell-extension-install


Warning: file(https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/ubuntugnome/gnome-extension/shell-extension-install): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /mnt/data/home/www/www-bernaerts/plugins/system/sourcerer/helper.php(560) : runtime-created function on line 7

Warning: Invalid argument supplied for foreach() in /mnt/data/home/www/www-bernaerts/plugins/system/sourcerer/helper.php(560) : runtime-created function on line 7

To install this script, you can directly download it from my Github repository to /usr/local/sbin :

# sudo wget -O /usr/local/sbin/shell-extension-install https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/ubuntugnome/gnome-extension/shell-extension-install
# sudo chmod +x /usr/local/sbin/shell-extension-install

Script is now installed and available to download & install any extension available from Gnome Shell Extensions site.

3. Script Example

Now that the Extension Installation script is operational, you can process to some batch installation.

For example, the following script will install all the following extensions on a Gnome Shell 3.4 system :

  • Remove accessibility
  • Axe menu
  • Media player indicator
  • system monitor
  • Brightness control
  • Calculator
  • Weather

install-my-extensions

#!/bin/sh

# Remove Accessibility
shell-extension-install 3.4 112

# Axe Gnome Menu
shell-extension-install 3.4 327

# Media Player Indicator
shell-extension-install 3.4 55

# System Monitor
shell-extension-install 3.4 120

# Brightness Control
shell-extension-install 3.4 231

# Calculator
shell-extension-install 3.4 111

# Weather
shell-extension-install 3.4 613

# Reload Gnome Shell
gnome-shell --replace &

You just need to run it :

# ./install-my-extensions

It will install all your favorite extensions and reload Gnome Shell when everything is done (equivalent to ALT F2 + r).

When it comes to productivity gains, Gnome Shell and its extensions really deserve a big Keep It Simple, Stupid ...


Hope it helps.

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus