With gtk+ ≥ 3.12
you can load a specific theme and its variant (dark, light) on a per-application1 basis via the environment variable GTK_THEME=theme:variant
. As per the gtk+
reference manual:
GTK_THEME. If set, makes GTK+ use the named theme instead of the theme that is
specified by the gtk-theme-name setting [...] It is also possible to specify a
theme variant to load, by appending the variant name with a colon, like this:
GTK_THEME=Adwaita:dark.
So, to load2 the dark variant you would run:
GTK_THEME=Adwaita:dark gedit
Likewise, to achieve the opposite (when the default theme is dark), you load the light variant:
GTK_THEME=Adwaita:light gedit
Note that if you want to use it via a custom launcher (.desktop
file) you'll have to prepend env
to the command in the Exec
line:
Exec=env GTK_THEME=Adwaita:dark eog %U
1: Worth noting that - as per the devs decision - newer gnome-terminal
has its own configuration via menu > preferences and it ignores the theme. Also, since this is rather new stuff, some gtk+ 3 applications might not (yet) honor the GTK_THEME
environment variable.
2: This doesn't seem to work if you already have a running instance of that application e.g. if nautilus
is already running in dark mode then running GTK_THEME=Adwaita:light nautilus
will open a new nautilus
window but still in dark mode. I don't know if this is a feature or a bug...