Setting a custom Gtk theme for specific applications
July 13, 2008
I’m not entirely sure why you’d want to use this, but it does get asked from time to time: How can you use a different Gtk theme, icon theme and/or fonts for specific Gtk applications?
If you just want to change the Gtk theme, you can launch your application with the following command:
Thus “GTK2_RC_FILES=/home/urukrama/.themes/royalty/gtkr-2.0/gtkrc thunar” will use the Royalty theme for Thunar. Note that this will use the default font and icon theme, not the icon theme or font you specified in your ~/.gtkrc-2.0 or ~/.gtkrc.mine file.
If you’d also like to set a custom icon theme and font for the application, create an empty file, wherever you find convenient (for example in /home/USERNAME/.themes) and call it whatever you want (for example, custom.gtkrc). Then add the following to that file:
#To set the Gtk theme
#To set the icon theme
gtk-icon-theme-name = "GnomeCorsair"
#To set the font
font_name = "Sans 8"
widget_class "*" style "Sans"
gtk-font-name = "Sans 8"
Change ‘GnomeCorsair’ to the icon theme you’d like to use, and “Sans” to the font you prefer. The /path/to/your/theme/gtkrc is what it says (for example /home/urukrama/.themes/royalty/gtkr-2.0/gtkrc). If you would only like to have a custom icon theme or font, only specify those and leave the rest out.
To launch Thunar with these settings, use the following command (If you saved the file elsewhere, adjust the path accordingly):
If you want to use this in a launcher such as Openbox’ menu, rather than the terminal, try the following:
bash -c 'GTK2_RC_FILES=/path/to/your/gtkrc application-command'
I haven’t managed to get this working with either the gnome-settings-daemon or the xfce-mcs-manager running. It seems they override this.
As proof that this works, here is a screenshot of two instances of Mousepad running, one using the default theme, the other launched with a custom gtkrc: