Themeing Gnome 3

Section: Linux

Gnome 3 is the next incarnation of the Gnome desktop. It aims to simplify things and put the focus back on work. At the time of writing then it has just reached its first release, and openSUSE have a repo for it (as well as a previous build included by default in openSUSE 11.4).

While Gnome 3 isn't everyone's idea of a good UI, I've moved to it anyway to stay current and to give it a change for its slightly new paradigm. There are still a few things that are less configurable than they were, but overall it looks promising.

The problem

When I first migrated to the Gnome 3 repo, it broke. The desktop wouldn't load properly and it generally wasn't happy. Using Yast to swap all packages to the Gnome 3 repo fixed that (after a lot of conflict resolution that focused on saying "delete package"), but I was left with a Raleigh GTK theme (think Windows 95 - grey, ugly and boxy).

After installing gnome-themes-standard then I got the a couple of extra themes, then I installed metatheme-adwaita-common to get the default Gnome 3 theme - Adwaita. Running up gnome-tweak-tool still showed me a list of icons and GTK themes that didn't include those I'd build in /usr/local.

While Adwaita is okay, I like my themes darker. Specifically, I like openSUSE's Sonar theme (darkened slightly) and I like the fix that I put in to make the Chromium tab background the same grey as my title bar. I also like the collection of Tango icons that I've built up. The hunt was on to work out how to use them

Making the icon themes work

For some reason, Gnome 3 seems to ignore icon themes in /usr/local/share/icons and only loads themes from /usr/share/icons. I keep /usr/local on a separate partition so that it is safe if I wipe the root (/) partition in a re-install. The solution was symbolic links:

sudo ln -s /usr/local/share/icons/* /usr/share/icons/

If you get warnings about folders existing (e.g. hicolor) then either ignore it or symlink the individual icons.

This solution obviously won't survive beyond a reinstall, but hopefully the Gnome 3 guys will support icons from /usr/local by then.

Making GTK2 apps use Sonar

This is where the real bodging began - splicing themes! No Sonar theme for GTK3 currently exists, so we can only handle GTK2. Luckily, most of my apps are still GTK2 apps anyway.

First, use Adwiata as a base:

sudo cp -r /usr/share/themes/Adwaita /usr/local/share/themes/Adwaita-Sonar sudo ln -s /usr/local/share/themes/Adwaita-Sonar /usr/share/themes/

Then splice in the Sonar styling:

sudo cp /usr/share/themes/Sonar/gtk-2.0/gtkrc /usr/local/share/themes/Adwaita-Sonar/gtk-2.0/gtkrc

Finally, edit the name so that we can differentiate in the list:

sudo sed -i 's/Adwaita/Adwaita-Sonar/g' /usr/local/share/themes/Adwaita-Sonar/{index.theme,metacity-1/metacity-theme-{2,3}.xml}

The only thing that is missing is colour selection. There is a key in the Gnome Configuration Editor called /desktop/gnome/interface/gtk_color_scheme, but it doesn't seem to work under Gnome 3. Instead, I had to manually edit the gtkrc for Adwaita-Sonar, as Sonar declared its own versions of the colours at the top.

Making GTK3 apps use Sonar

Unfortunately, this isn't possible at the moment. There isn't a Sonar theme that I can find for GTK3. There is a package on the openSUSE Build Service, but it doesn't contain a theme. GTK3 themes appear to be CSS based, so hopefully someone will create one soon.

Using the theme

Open the Gnome Tweak Tool (which should be part of the final release of Gnome 3) and go to the Interface section. Your icon themes and GTK2/3 spliced theme should now be available!