fix gtk2/3 theme and icons in i3

posted on: January 28, 2019


I mostly use the i3 tiling window manager on my FreeBSD laptop, when I'm not using i3 I like the Xfce desktop environment with the Xfce Evolution theme and elementary-xfce icons.

I recently got tired of my gtk2 and gtk3 applications (the Thunar file manager especially) not looking the same when switching between i3 and Xfce. The theme/icons I set in the Xfce settings are not preserved when using i3 (or probably any other window manager), so I set out to fix that.

First (optionally) install the theme and icon theme I use:

pkg install xfce-evolution xfce-icons-elementary

Fix the icons and theme for gtk2:

echo "gtk-icon-theme-name=\"elementary-xfce\"" >> ~/.gtkrc-2.0
echo "gtk-theme-name=\"Xfce Evolution\"" >> ~/.gtkrc-2.0

Fix the icons and theme for gtk3:

mkdir -p ~/.config/gtk-3.0
echo "[Settings]" >> ~/.config/gtk-3.0/settings.ini
echo "gtk-icon-theme-name=\"elementary-xfce\"" >> ~/.config/gtk-3.0/settings.ini
echo "gtk-theme-name=\"Xfce Evolution\"" >> ~/.config/gtk-3.0/settings.ini

If you want to get a list of all possible icon themes choose a directory from:

ls /usr/local/share/icons

To get a list of all the possible gtk2 themes pick from the list produced by:

find /usr/local/share/themes -name gtk-2.0 | cut -d / -f 6

To get a list of all the possible gtk3 themes pick from the list produced by:

find /usr/local/share/themes -name gtk-3.0 | cut -d / -f 6

For a list of all the possible values for ~/.gtkrc-2.0 look in the Properties section of GtkSettings.

I gathered up this information after reading a FreeBSD forum thread.


tags: freebsd | i3 | tip