Skip to content

Instantly share code, notes, and snippets.

@colematt
Created June 20, 2024 02:41
Show Gist options
  • Save colematt/6c09dae55be1873e1b763aa681a526e5 to your computer and use it in GitHub Desktop.
Save colematt/6c09dae55be1873e1b763aa681a526e5 to your computer and use it in GitHub Desktop.
[Run an app in dark or light mode without changing global GNOME settings] #linux #gnome

Pass the GTK_THEME environment variable to the app:

$ GTK_THEME=<theme> <path>

You can replace <theme> with any available theme:

$ ls /usr/share/themes
Adwaita  Adwaita-dark  Default  Emacs  HighContrast  Pop  Pop-dark  Raleigh

Note that the Adwaita-dark theme is actually Adwaita:dark. For .desktop files, you need to wrap the command inside a shell command. For example:

[Desktop Entry]
Version=1.0
Name=PulseUI
Comment=LINUX UI CLIENT
Exec=bash -c "GTK_THEME=Adwaita /opt/pulsesecure/bin/pulseUI"
Icon=/opt/pulsesecure/resource/pulse.png
Terminal=false
Type=Application
Categories=Utility;Application;
StartupWMClass=pulseUI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment