Changing the look and feel for GTK apps by hand

Posted on .

If you’re using a lightweight window manager or desktop environment like i3 or fluxbox you may want to tune the appearance of the few GTK or Qt apps you run. They could be Firefox, Thunderbird, Thunar, Wireshark, or whatever. I’ll focus on GTK for now as that’s what affected me. You probably want to change GTK settings without installing or using any application to change them, as they usually bring a myriad of dependencies to your system. What files to edit?

The answer can be easily found in the ArchWiki, the wiki for ArchLinux. It’s a fantastic website with a lot of information, from high level descriptions to the small details you want to know, like in this case. In recent years it has taken the position previously held by the Gentoo wiki, in my opinion.

Before you start, you may want to install a few packages in your system containing icon themes and themes for GTK2 and GTK3. In recent versions, Adwaita is supposed to be the default theme and it looks pretty decent. Also interesting are the Gnome or Tango icons because they’re very complete sets.

GTK2

After that, changing the appearance of GTK2 apps has been very well documented for years. Basically, create a file named $HOME/.gtkrc-2.0 like the following one:

gtk-font-name = "DejaVu Sans 9"
gtk-icon-theme-name = "gnome"
gtk-theme-name = "Adwaita"

GTK3

Manually configuring GTK3 is not as well documented usually and not as easy to find with a web search even if it’s not hidden either, but ArchWiki clarifies everything perfectly. You have to create “$XDG_CONFIG_HOME/gtk-3.0/settings.ini”. Usually that translates to ~/.config/gtk-3.0/settings.ini when XDG_CONFIG_HOME is not set. From there you can choose the theme, the icon theme, the fallback icon theme (for icons that are missing in the main theme, I guess) and the font name and size. Example:

[Settings]
gtk-application-prefer-dark-theme = false
gtk-theme-name = Adwaita
gtk-fallback-icon-theme = gnome
gtk-icon-theme-name = Adwaita
gtk-font-name = DejaVu Sans 9

And that’s it. After changing any of those files, restarting apps should be enough for them to pick up the new settings. As you can see, ArchWiki has an equivalent page for Qt too. To know which GTK2 and GTK3 themes are available in your system, apart from checking which packages are installed, look in the /usr/share/themes directory. Theme names are the directory names in there. If a theme has a gtk-2.0 subdirectory, it should be usable for GTK2. If it has a gtk-3.0 subdirectory, it should be usable for GTK3. Icon themes can be found in /usr/share/icons.

comments powered by Disqus