Sunday, October 02, 2011

User theme extension in Gnome Shell on Oneiric

Gnome Shell is pretty lacking in the customisability department right now. Gnome Shell extensions provide a way of augmenting the default Gnome Shell desktop with features not available by default. For some reason, Gnome Shell doesn't let you customise the theme by default.

Thankfully, there's an extension for that. It's the user themes extension. Getting it to work on Oneiric proves a little tricky though since there's no official packages that provide them. Only the standard Gnome Shell is provided in universe.

There's two ways of installing extensions in Oneiric at the moment: use Ricotz PPA, or manually install using the git repository.

Using Ricotz PPA

Adding the PPA and installing Gnome Shell is a simple task:

~$ sudo apt-add-repository ppa:ricotz/testing
~$ sudo apt-get update
~$ sudo apt-get install gnome-shell gnome-shell-extensions-user-theme

Logout, then login after selecting to use Gnome as your desktop session, and things should work. Remember that this is a testing PPA and you're installing onto a development version of Ubuntu, so expect possible breakage from time to time.

Installing from source

Alternatively, get the gnome extensions source straight from Gnome's website. You'll need git and gnome-common as well.

~$ sudo apt-get install git-core gnome-common
~$ git clone git://git.gnome.org/gnome-shell-extensions

Now to install the extension. Here I'm installing the user themes extension, but the steps should work for any of the extensions in the Gnome repository.

~$ cd gnome-shell-extensions
~$ ./autogen.sh --prefix=$HOME/.local --enable-extensions="user-theme"
~$ make install
~$ sudo cp './extensions/user-theme/org.gnome.shell.extensions.user-theme.gschema.xml' '/usr/share/glib-2.0/schemas/org.gnome.shell.extensions.user-theme.gschema.xml'
~$ sudo glib-compile-schemas /usr/share/glib-2.0/schemas

Thanks to this wiki article for info on how to compile gsettings schemas. It seems merely copying the schemas over isn't enough.

The metadata.json file for the extension also may need editing. The extension from the git repository is set for version 3.1.92 at time of writing. You'll need to change it to (or add) 3.2.0 which is the version used in Oneiric. You can find this file in /home/username/.local/share/gnome-shell/extensions/user-theme@gnome-shell-extensions.gnome.org

Change

 "description": "Load shell themes from user directory",
 "shell-version": [ "3.1.91" ],

to

 "description": "Load shell themes from user directory",
 "shell-version": [ "3.1.91", "3.2.0" ],

and you're all set.

Now we're ready. Restart your desktop session with a login using Gnome Shell as your desktop. Advanced Settings won't see the extension otherwise. You should now be able to see a toggle for turning user themes on/off.

gnome-tweak-tool showing available extensions

Make sure it's set to on (of course), then you'll be able to use it under the themes section. Here's a shot of my desktop. For testing purposes I've downloaded a random theme from DeviantArt to see if things work.
Note: You'll need to store your downloaded themes in a folder called .themes in your user /home folder.

Gnome Shell using Ambiance Blue theme
Ambiance Blue seems to load fine. I've even tried Elementary and it works.