GTK apps not respecting configuration [SOLVED]

Hi to everyone! This is my first post, so i’ll try to be as good as possible in the forum.

I’ve started to experience a weird problem, with GKT2/3 apps in my EndeavourOS install. I’m using i3, so I don’t have a fully fledged DE. I use lxappearance-gtk3 to config the themes and other stuff to GTK2/3 apps. It usually works normally.

After updating everything today (2022-11-16) and restarting the machine, GTK apps seem to ignore configuration and i don’t know why.

If i start lxdeappearance i can change the theme and the app reflects that. I hit apply, then i close and start it again, and the theme is reverted, even if the config files reflect the theme i previously choosed and applied.

I don’t have any envvar related to GTK set. I have even changed the default files that come with Arch ( /usr/share/gtk-2.0/gtkrc and /usr/share/gtk-3.0/settings.ini) but nothing seems to work.

Even if i try to start the app like this:

GTK_THEME=Adwaita:dark lxappearance

or this

GTK_THEME=Adwaita-dark lxappearance

it keeps loading the Adwaita (light) theme.

Could someone please help me with this?

Here are my specs: https://0x0.st/oIVZ.txt

Thanks in advance!

I don’t know the answer to this one it sounds pretty weird. But maybe something from one of these two links will help if you haven’t seen them yet. I can’t think of a reason why setting the environment variable directly before launching app wouldn’t work.

Thanks @KDen !

I will definitely check out those links.

I have an update, I managed to change the theme permanently with xfce4-appearance-settings (I don’t know why it is installed) I can change everything but the mouse pointer theme.

And I confirmed that that app doesn’t change the values of ~/.config/gtk-3.0/settings.ini nor ~/.gtkrc-2.0 so I will keep investigating where that config is being saved.

Because those files are for settings you will use globally, regardless of the theme used. The app detect and apply themes located in /usr/share/themes, ~/.themes or ~/.local/share/themes.

Did you try with gsettings ?

gsettings set org.gnome.desktop.interface gtk-theme "Adwaita:dark"

or

gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark"

If you have installed some DE(s) which include relevant utilities/daemons that control theming, they might interfere with each other.

Moving forward, GTK apps will no longer support setting preferences by explicitly specifying the theme i.e. GTK_THEME=Adwaita:dark. While it still works on my machine, there is a warning message when running apps from command line with this set, such as timeshift-gtk:

“Using GtkSettings:gtk-application-prefer-dark-theme together with HdyStyleManager is unsupported. Please use HdyStyleManager:color-scheme instead.”

Which led me to this:

Moving forward, you may eventually need to set preferences like so:

gsettings set org.gnome.desktop.interface color-scheme ‘prefer-dark’

From the terminal, running an app would then work like the following, using gnome-disks as an example:
COLOR_SCHEME=prefer-dark gnome-disks

(COLOR_SCHEME=prefer-dark as opposed to GTK_THEME=Adwaita:dark)

Note this will only work in the future if the app supports it. A GTK app is not required to support theming preferences using handy style manager. Use of color preferences with libadwaita will become obsolete most likely.

1 Like

I had similar issues a few months ago. Learning gsettings is your best bet.

I found

man gsettings

to be helpful enough for me to see all the possible settings and change what I needed to change. That helped with almost every app.

However, I resorted to git clone one app’s repo and building it myself AFTER making some changes to the various GTK settings in the source code. It was an education!

ymmv

Thanks for all of your replies.

I remember now that I installed xfce4 so my wife could use the computer and not be bothered with i3. I think that’s the issue, as @petsam told and from now on I will manage settings via xfce4 utilities.

I will also look into gsettings as @13zebras advised.

I will mark this issue as solved. Thanks everyone!

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.