This is a quick note about testing changes to the official GNOME GTK+ theme Adwaita1.

During this Summer, I contributed to other CSS-based themes, but Adwaita is different for two main reasons:

  1. it uses Sass.
  2. it is released in binary form as a gresource.

I used Sass for fun some time ago, hopefully I will remember it quickly, but as a gresource, the theme is loaded into memory and there are no .css files to modify on the fly. So I spent some time this weekend to understand how to test the changes on the theme.

The solution I have tried works fine, but it looks sub-optimal to me. I am pretty sure that should be possible to do something with jhbuild, but since I did not find a way so far, here is how I am going to play with Adwaita theme:

  • copy Adwaita folder from /usr/share/themes into the hidden .themes folder in Home (after a fresh install, it does not exist, so I created it).
mkdir -p ~/.themes
cp -r /usr/share/themes/Adwaita/ ~/.themes
  • change its name to make it easier to distinguish between the original and the copy when selecting the theme.
cd  ~/.themes
mv Adwaita AdwaitaMod
cd AdwaitaMod
sed -i "s/Adwaita/AdwaitaMod/g" index.theme
  • get a copy of gtk+ project2.
cd ~/workspace
git clone git://git.gnome.org/gtk+
  • copy gtk+’s Adwaita folder content into a gtk-3.0 inside the folder made at step 2.
cd ~/.themes/AdwaitaMod/gtk-3.0
cp -r ~/workspace/gtk+/gtk/theme/Adwaita/* .
  • change gtk.css @import directive to import the local gtk-contained.css file (or its dark version).
$ cat gtk.css
@import url("gtk-contained.css");
  • finally, install sassc to compile .scss files into .css
sudo apt install sassc

To make any change to the .scss files visible, run the parse-sass.sh script to update gtk-contained.css file.

Notes

  1. A couple of days ago I volunteerd for the Ubuntu theme refresh project, that aims to renew Ubuntu theme starting from Adwaita[↩].
  2. I actually got mine using jhbuild, but that would be too long and not necessary so far[↩].