9

Is there a way to install GNOME extensions from terminal, for example dash to dock? The way I do it now is to go into Ubuntu Software app store and install it.

pomsky
  • 68,507
  • You can visit extensions.gnome.org and install them from your browser, just like a browser plugin. For instance, Dash to Dock is here: https://extensions.gnome.org/extension/307/dash-to-dock/ You may need to install a "host connector" first but your browser will tell you how. – Jos Jun 20 '19 at 12:25
  • 1
    Thanks but I want to install it from terminal, as I will put it in a script that automates my stuff –  Jun 20 '19 at 12:26
  • Then get the package name from the Ubuntu store and do apt install -y [package-name] in your script. – Jos Jun 20 '19 at 12:27
  • thanks, i tried that before and I could not find the packages, now I found them. –  Jun 20 '19 at 12:44
  • 1
    At https://linuxconfig.org/how-to-install-gnome-shell-extensions-from-zip-file-using-command-line-on-ubuntu-18-04-bionic-beaver-linux you will find generic instructions to install a gnome shell extension that properly is packed into a zip file. – vanadium Jun 20 '19 at 13:56

3 Answers3

4

Dash to Dock GNOME extension

As seen at https://extensions.gnome.org/extension/307/dash-to-dock/

Download the .zip file here https://micheleg.github.io/dash-to-dock/releases.html

Note: the name of the downloaded .zip file may be different than the dash-to-dock@micxgx.gmail.com.zip shown in the unzip command shown below. Adjust the command as necessary for the correct .zip name.

See the manual installation notes here https://micheleg.github.io/dash-to-dock/download.html

Manual installation

You can also obtain the extension in the form of a zip archive from the release page. Look for the latest version supporting your shell version. The extension can be installed by means of gnome-tweak-tool, or alternatively by directly extracting the archive in the a directory named dash-to-dock@micxgx.gmail.com inside ~/.local/share/gnome-shell/extensions/

unzip dash-to-dock@micxgx.gmail.com.zip \ -d ~/.local/share/gnome-shell/extensions/dash-to-dock@micxgx.gmail.com/

Shell reload is required Alt+F2 r Enter. The extension can be enabled with gnome-tweak-tool, or with dconf by adding dash-to-dock@micxgx.gmail.com to the /org/gnome/shell/enabled-extensions key.

Note: DtD is not compatible with 19.04.

  • rumor has it, that if you uninstall Ubuntu Dock, that DtD will work with 19.04

  • it also appears that the manual installation of DtD will make this work in 19.04

heynnema
  • 70,711
  • 1
    I am using DtD now with ubuntu 19, no problems at all, been using it for a month –  Jun 21 '19 at 07:17
  • @themeguy DtD apparently conflicts with the Ubuntu Dock extension, so if you uninstalled that, DtD might work fine. If you didn't uninstall that, you're just lucky that DtD is working for you. – heynnema Jun 21 '19 at 12:12
  • hmmm no idea, ubuntu dock is disabled on my pc by default –  Jun 21 '19 at 12:14
2

You can install Dash-to-Dock by running the following commmand:

sudo apt install gnome-shell-extension-dashtodock

You can get the list of available extensions by running apt search gnome-shell-extension for example.

pomsky
  • 68,507
  • Remember that Dash to Dock isn't compatible with 19.04. There's some mumbling about uninstalling the standard Ubuntu Dock GNOME extension, and then DtD may work. – heynnema Jun 20 '19 at 17:22
  • 1
    I am using Dash to Dock right now on ubuntu 19 without a problem –  Jun 20 '19 at 18:13
  • I tried this solution and it actually does not work. The extension shows up in gnome tweak tool, but it is not activated, i.e. the dock is still the same. And if I click extension settings in gnome tweaks, it refers me to the ubuntu store to download dash to dock. –  Jun 20 '19 at 18:14
  • @themeguy Have you tried logging out and logging in again (or rebooting the system)? Anyway, using Dash-to-Dock with the default Ubuntu dock activated is not a good idea. Since Ubuntu dock is a fork of Dash-to-Dock, they share many gsettings/dconf schemas. So various issues may appear. – pomsky Jun 20 '19 at 22:27
  • @pomsky The standard Ubuntu Dock GNOME extension is always disabled. – heynnema Jun 21 '19 at 01:05
  • It might show up as disabled in Tweaks, but that can be misleading. Since it's a pre-installed system extension, it's most likely always active in a standard Ubuntu session. – pomsky Jun 21 '19 at 06:36
  • I have tried rebooting yes. –  Jun 21 '19 at 07:16
  • @pomsky Ubuntu Appindicators and Ubuntu Dock are "mock" GNOME extensions and always show as disabled at https://extensions.gnome.org/local/ – heynnema Jun 21 '19 at 12:09
  • "show as disabled", that's the key part :) As I said before they are pre-installed system extensions activated by default in a standard Ubuntu session. Those 'mock' extensions are created 'to protect and reserve the name' (i.e. avoiding conflict). – pomsky Jun 21 '19 at 12:17
2

I just found two ways to install from the terminal. Personally, I prefer the python packaged tool for its simplicity, but the second way might give You more fine grained control over the installation process.

A) With a python package

# 1. Install the package
pip3 install gnome-extensions-cli

2. Install extension by UUID

gnome-extensions-cli install dash-to-dock@micxgx.gmail.com

2.a ... or by PK (primary key)

gnome-extensions-cli install 307

More information on the github page: https://github.com/essembeh/gnome-extensions-cli or use the gnome-extensions-cli --help.

If there is no active gnome shell session, the tool will complain. To fix, use --backend file.

B) With custom shell scripts

#!/usr/bin/env bash

uuid=dash-to-dock@micxgx.gmail.com pk=307

1. GNOME shell version

shell_version=$(gnome-shell --version | cut -d' ' -f3)

2. Fetch extension info (for the given shell version)

info_json=$(curl -sS "https://extensions.gnome.org/extension-info/?uuid=$uuid&shell_version=$shell_version")

2.a instead of ?uuid=$uuid you can use ?pk=$pk

3. Extract download url from the json with jq

download_url=$(echo $info_json | jq ".download_url" --raw-output)

4. Install the extension

gnome-extensions install "https://extensions.gnome.org$download_url"

4.a ... or download it first, then install

curl -sL "https://extensions.gnome.org$download_url" -o $uuid.zip gnome-extensions install $uuid.zip

4.a.i ... or manually extract the zip

mkdir -p ~/.local/share/gnome-shell/extensions/$uuid unzip $uuid.zip -d ~/.local/share/gnome-shell/extensions/$uuid

This is more or less the same as the python package does - apart from using the gnome-extensions utility that comes with the GNOME Shell.

JQ is a command line json processor - more on usage: https://stedolan.github.io/jq/