Setting theme for gtk4 applications?

I’m running Manjaro with XFCE. Using the XFCE Appearance setting I changed the theme to Matcha-light-azul. This works fine, except for gtk4 applications (such as gnome-system-monitor). As explained here, setting GTK_THEME solves this, and gtk4 applications use the theme’s titlebuttons instead of the default ones: https://forum.manjaro.org/t/how-to-theme-gtk4-apps-in-manjaro-xfce/100189/7
See also here: https://forum.manjaro.org/t/xfce-desktop-with-gnome-system-monitor-theme-problem/161650

I can set GTK_THEME in /etc/environment, but then it applies to all users (is there a config file to put this in which only affects the specific user?). More importantly, switching themes in the Appearance settings does not change this, of course.
Is there a more appropriate mechanism which could be made react on switching the appearance setting (just as the Appearance config pane has an option to automatically affect the XFCE windows settings if the selected theme does support it)?
Using gsettings as mentioned in https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/406 does not seem to affect the GTK4 application’s titlebuttons (just the color theming dark/light of the main part of its windows).

1 Like

~/.profile

~/.config/gtk-3.0/settings.ini
~/.config/gtk-4.0/settings.ini

[Settings]
gtk-theme-name=Adwaita
gtk-icon-theme-name=Adwaita
gtk-font-name=Cantarell 11
gtk-cursor-theme-name=xcursor-breeze
gtk-cursor-theme-size=0
1 Like

[Settings]
gtk-theme-name=Matcha-light-azul

in ~/.config/gtk-4.0/settings.ini does not have any effect.

Putting
export GTK_THEME=Matcha-light-azul
to ~/.profile does not show any effect either.

In contrast, putting
GTK_THEME=Matcha-light-azul
in /etc/environment does yield the desired effect (after a re-login), as does starting the application directly with
env GTK_THEME=Matcha-light-azul gnome-system-monitor

What am I doing wrong?

2 Likes

This is the right approach and it works. You just have to source the profile and relogin.
For example you can add [[ -f ~/.profile ]] && . ~/.profile to .bash_profile

2 Likes