You Got A Question? Ask    GNOME Community!


Running GTK+ Applications | Different Themes Per App

As you already know some applications are meant to use the Dark variant of the GTK themes, while others are using the Light one. Unfortunately, GNOME Apps don’t give us the choice (some do!) to pick the variant we want.

However there is a small trick to override this, by using the GTK_THEME flag.

[caption id="attachment_26004" align="aligncenter" width="640"]totem-white Totem uses the Adwaita Light
System Theme is set to Adwaita Default[/caption]

Trying it

$ GTK_THEME=Adwaita totem
[caption id="attachment_26005" align="aligncenter" width="640"]gedit-dark GEdit uses Adwaita Dark
System Theme is set to Adwaita Default[/caption]

Trying it

$ GTK_THEME=Adwaita:dark gedit
[caption id="attachment_26006" align="aligncenter" width="640"]widgets-adwaitaosx Gtk3-Widgets-Factory uses Adwaita OS X Dark
System Theme is set to Adwaita Default[/caption]

Trying it (if you have Adwaita OS X, obviously!)

$ GTK_THEME="Adwaita OS X:dark" gtk3-widget-factory

Making The Changes Permanent

Explaining how we can make the changes permanent isn’t a goal of this post (see why on “Notices”), but I will share a small tip.

For example, lets make GEdit to always use the Adwaita Dark variant, no matter what is the system-wide theme.

Override the Desktop file

$ cp /usr/share/applications/gedit.desktop ~/.local/share/applications/gedit.desktop

Edit it

$ gedit ~/.local/share/applications/gedit.desktop
...
Comment[zh_HK]=編輯文字檔
Comment[zh_TW]=編輯文字檔
Exec=env GTK_THEME=Adwaita:dark gedit %U
Terminal=false
Type=Application
...

Restart the Shell and try it

Alt+F2 +"r"

Notices

While GTK_THEME flag should work for all GNOME applications, it actually doesn’t (not a clue why). So you should experimental a bit what works, what doesn’t.

Furthermore, this flag is been here mainly for debugging purposes and not for regular use.

You can see more nice tricks as this one, on GNOME documentation.

[caption id="attachment_26027" align="aligncenter" width="640"]emacs-dark This won’t work with Title-bars (window-bars), but only with the GTK-Header-Bars of the newest GNOME Apps.[/caption]
This environmental variable is available for GNOME 3.12+. For GNOME 3.10 check at:


What If..

It would be really awesomely cool if every GNOME App had a drop-down list in preferences (DDE, Deepin does this), that would let us to set theme per application -with the theme that is specified by the gtk-theme-name setting, as default.

[caption id="attachment_25973" align="aligncenter" width="640"]pasasite-themes GTK+ Inspector (GTK 3.14+) can set custom Theme per Application[/caption]

Yeap, it is perfectly doable, GTK+ Inspector (Parasite) already does that!


 
  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community