How to use a different theme for individual applications

:warning: This tip works for GTK2 or GTK3 themes and applications. This post does not cover applications based on other toolkits, such as Qt.


GTK2 Applications

As an example, I'll use the text editor, pluma, which is based on GTK2 in 16.04.

For system-wide themes:

env GTK2_RC_FILES=/usr/share/themes/BlackMATE/gtk-2.0/gtkrc  pluma

For locally installed themes:

env GTK2_RC_FILES=$HOME/.themes/BlackMATE/gtk-2.0/gtkrc  pluma

GTK3 Applications

As an example, I'll use the disk utility, gnome-disks, which is GTK3 in 16.04 and beyond. Software pre-installed in 16.10 onwards are built against GTK3.

env GTK_THEME="BlackMATE"  gnome-disks


The Result

Pluma now matches the dark syntax theme -- more pleasing to the eyes. :sunglasses:


If you need a guide on making this persistent and identifying themes, keep reading.

Which theme?

First, make a note of which theme you'd like to use for that specific application and find the directory name associated for it.

You can see your locally installed and system wide themes in Preferences → Look & Feel → Appearance. Any themes you download can be stored in ~/.themes or installed to /usr/share/themes for all users.


Update the Launcher / Main Menu

Before we start committing to this theme, check that it works in the terminal as expected.

Not all applications are based on GTK, but many programs like pluma, libreoffice, geany, inkscape, gimp are, just to name a few. Beware that GTK2 and GTK3 applications differ slightly in their behaviour and appearance.

All good? Right-click the main menu and select Edit Menu.

Double click the application and paste the env section of the command to the start. Ensure you start with env (which is setting an environment variable for that application) and not accidentally delete any arguments (which passes your files)... or the command itself.

That's all. Specific programs can use different themes to the rest of your session.

Have fun customizing your system! :smile:


:thumbsup: Thank you to this answer on askubuntu.com

5 Likes

Maintainer of the OS learns something :open_mouth:

4 Likes

I have an issue with this - pluma was not giving me BlackMate (even BlackMATE was copied in .themes folder)
Problem is that the path to home folder was interpreted as: /home/home/username, so to made this functional just modify this to:

env GTK2_RC_FILES=/$HOME/.themes/BlackMATE/gtk-2.0/gtkrc pluma (remove first “home” in path)

Regards,
Vlada

1 Like

Oops, thanks for pointing that out @vlajkom . /home/$USER/ would have worked too. I’ve amended this on the post.

1 Like

Thank you so much, I confirm that this works with Kdevelop 5, which is a QT5 application I thought!