Per application dark theme

I am using the ZorinBlue-Light theme during the day, and ZorinBlue-Dark during the night. But for some apps it makes sense that they're always in dark mode, because they have a dark UI, like Spotify or GIMP.

On ZorinOS 17 I could do this by modifying the flatpak application environment variable "GTK_THEME=ZorinBlue-Dark" and it would do the job. On ZorinOS 18 this no longer works. Any idea on how to get dark theme only for certain applications? Thanks!

Hi and welcome.

Brave A.i. search using Ubuntu 24.04 in search criteria as Zorin 18 is a fork of same gives:

" To apply a dark theme to individual applications without affecting the global theme in Ubuntu 24.04, use the GTK_THEME environment variable when launching the application.

Per-Application Launch via Command Line

Set the GTK_THEME variable to load a specific theme variant (e.g., Adwaita:dark ) only for that app:

GTK_THEME=Adwaita:dark gedit

This applies the dark theme to only that instance of the application and does not change the system-wide theme.

Persistent Setup via Desktop Entry (Recommended)

To make this apply every time you launch the app:

  1. Copy the app’s .desktop file from /usr/share/applications/ to ~/.local/share/applications/ .
  2. Edit the file and modify the Exec= line to prepend env GTK_THEME=Adwaita:dark :
Exec=env GTK_THEME=Adwaita:dark /usr/bin/gedit %F
  1. Save and close the file. The app will now launch with the dark theme every time, regardless of the global theme.

:warning: Note : This method works best for GTK 3 and GTK 4 applications. Some apps (like newer versions of GNOME Terminal) may ignore GTK_THEME due to internal theming logic. For such cases, use dedicated settings (e.g., gsettings set org.gnome.Terminal.Legacy.Settings theme-variant 'dark' ).

Alternative: Dynamic Theme Enforcement

For a more automated approach, use a script that monitors window classes and applies dark themes dynamically:

  • Use tools like xprop , xdotool , and wmctrl to detect and modify window properties on the fly.
  • Example: Run a script that sets _GTK_THEME_VARIANT=dark for specific apps (e.g., Spotify, VLC) when they open.

:white_check_mark: Tip : If you're using a non-GNOME desktop (like MATE or XFCE), ensure gnome-tweaks is installed and use it to manage per-application themes safely.

AI-generated answer. Please verify critical facts."

Change the entries that state Adwaita to your preferred theme.