Gtk themes ignored by some applications

when setting a gtk theme using gnome-tweaks I figured out that some applications remained at a dark theme, eventhough I chose a light theme. I tested this behaviour with Adwaita Theme, Orchis-compact Theme, and WhiteSur Theme.
These applications remained in dark mode: gnome-boxes, gnome-photos, totem, eog

manually I could call them with the correct theme, e.g.
$ GTK_THEME=Orchis-compact gnome-boxes
I also encountered when setting the environment variable in /etc/environments everything works fine
GTK_THEME=Orchis-compact

BUT: this can only be considered a workaround, is there a better way to ensure that all applications follow the gtk theme?

I run Fedora 34 (Workstation Edition) with gnome 40.4

This is just GtkSettings:gtk-application-prefer-dark-theme. If you don’t want these applications to be dark you will have to either use the environment variable or else choose a theme that doesn’t include a dark variant at all. Sorry.

thanks for the hint!
interesting though, that there is a setting in both ~/.config/gtk-3.0/settings.ini and ~/.config/gtk-4.0/settings.ini
[Settings]
gtk-application-prefer-dark-theme=0
but this does not have any effect on the above mentioned apps.

I also tweaked around with ~/.profile and ~/.bashrc and entered the setting
gtk-application-prefer-dark-theme=0
but that also had no effect.

The only thing that has an effect is setting an environment variable in either /etc/environments or if necessary on a per user base in ~/.config/environment.d/00-theme.conf
GTK_THEME=Orchis-compact
That does the job, but it is weird that I have to set the chosen theme now at 2 places (in gnome-tweaks and in the file). Any hint for a better solution would be highly appreciated. I forgot to mention that I run Fedora in X.org mode, not Wayland.

Boxes is only tested with Adwaita dark so we enforce it to avoid a subpar user-experience. There’s a ~hidden~ setting to override that. https://gitlab.gnome.org/GNOME/gnome-boxes/-/blob/master/data/org.gnome.boxes.gschema.xml#L50

gsettings set org.gnome.boxes override-theme false

@felipeborges how can I change this override-theme value permanently to stay also after reboot and updates?