Some gtk apps misbehave with adwaita themes

Some gnome apps like totem, celluloid, eog and shotwell try set a dark theme regardless of the desktop preference. This usually does not affect custom themes like matcha, which get applied correctly. However, this causes problem for adwaita-maia: if the themes recognize that you are trying to use adwaita based theme, they automatically revert to Adwaita-dark, not Adwaita-Maia-dark. TO you have blues sticking out from manjaro greens on your desktop

This

  • cannot be avoided by renaming theme something other than adwaita
  • can be overridden with custom gtk.css, but somw blue elements seem to remain
  • can be overwritten by tweaking the application .destop files to force Adwaita-maia-dark, but these apps will not obey the global theme settings at all

First discovered by @Yochanan. @Ste74 @bogdancovaciu do you have any good ideas on how to overcome this?

Assumed only on Gnome or also other DEs?

Not tested on other de, but these are apps specific to gnome desktops and not included by default in other editions

1 Like

Proposed solution:

  1. write wrapper script thoushaltobeythetheme.sh. This script takes app command as the argument, gets the global gtk theme from dconf and unless that theme is adwaita, it forces the app to use that theme.
  2. insert that wrapper to the exec line of the offending apps

I think this is a good solution. @Ste74, what do you think?

Can be usefull this?
https://ubuntuforums.org/archive/index.php/t-2324018.html

My proposed solution is based on it, yes.

I'm thinking a wrapper like this:

#/usr/bin/env dash
cmd=$1
gtk_theme=$(dconf read /org/gnome/desktop/interface/gtk-theme | tr -d "'")
if [ $gtk_theme != Adwaita ] then
	exec GTK_THEME=${gtk_theme} $1
else
	exec $1
fi

As a bonus, it let's you use the light version adwaita-maia with these apps if you want to.

How you run this? You create a overlay for any offending apps in .local/bla/bla folder?

Copy the offending app desktop files to

~/.local/share/applications/

And prepend the script to the exec line of each desktop file.

I haven't yet tested the script though, the exec command in the script might be misplaced.

Ok, is what i mean :wink: but for an old installation how you can do this? For a new iso you put in the skel folder but for a old installation?

Yes

Old installs can adopt it manually if they want to adopt adwaita-maia? Otherwise, install script in adwaita-maia?

Another option is to sed the desktop files in /usr/share/applications with a pacman hook? Maybe the pacman hook would be better

Oh .. yes this can be usefull both for install and both for update/remove.. only is needed a list of apps to parse and check what are installed..

I can write that. Here is the final and working version of the script:


#/usr/bin/env dash
cmd=$1
gtk_theme=$(dconf read /org/gnome/desktop/interface/gtk-theme | tr -d "'")
if [ $gtk_theme != Adwaita ] && [ $DESKTOP_SESSION = "gnome" ]; then
	GTK_THEME=${gtk_theme} exec $1
else
	exec $1
fi

If you not are confortable with hook i can write for this job..

Well, it is faster if you write it. Discovered apps thusfar:

  • eog
  • shotwell
  • celluloid

I'll see if I can find any others

We can add other apps as needed.. this evening when come back to my home i do it :wink:

:running_man:

I like to use the smallest tool necessary. If you can do it with bash, you don't need python. If you can do it with dash, you don't need bash.

I did not test all the applications when using the theme. After i colorized the gtk2 assets for light and dark, the applications i use worked fine.

Are this GTK2 or GTK3 applications ? (never used them before)
@Chrysostomus - Should i do something else with the updated theme? Are you using this:

Forum kindly sponsored by