2

Can I change a certain application's GTK theme that would differ from the system set one?

I'd like to change Spotify's theme to be Qogir-black, but keep everything else on Qogir-light (two different theme folders) I want spotify window to have a black header.

Now it looks like this with a white header Spotify window with the white header

When I change the system theme (in gnome-tweaks) to dark, spotify header changes. So the problem is not in the theme.

I tried changing the /usr/share/applications/spotify.desktop file to this:

[Desktop Entry]
Type=Application
Name=Spotify
GenericName=Music Player
Icon=spotify-client
#TryExec=spotify
Exec=env GTK_THEME=Qogir-dark spotify %U
Terminal=false
MimeType=x-scheme-handler/spotify;
Categories=Audio;Music;Player;AudioVideo;
StartupWMClass=spotify

I followed this tutorial here but it didn't do the thing.

2
  • I guess the trick with setting the GTK_THEME variable only works for theming GTK3 applications, like nautilus, gedit, etc. It will not work on conventional ("legacy") window decoration and GTK2 applications such as Gimp. Not sure if for GTK2 themes can be changed on a per-app basis. – vanadium Sep 23 '18 at 15:06
  • @vanadium For gtk2 apps, I think you can use the gtkrc file and set the environment variable for that instead like in this answer. – mchid Jan 11 '20 at 1:22
0

I have found a solution that seems to work. Put in /usr/local/bin a file named spotify Open it with gedit and type

#!/bin/bash
/bin/spotify & 
sleep 0.2
xprop -f _GTK_THEME_VARIANT 8u -set _GTK_THEME_VARIANT "dark" -id $(xdotool getactivewindow)

type sudo chmod a+x /usr/local/bin/spotify for permissions

It needs xdotool to get spotify window id.

It works! I know that after a year it's a bit too late

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.