Cannot change GTK4 apps to dark with the command line

Hello, I have been trying to find a way to change GTK4 apps to dark theme with the command line, I have tried using gsettings, xconf, editing the config files; and nothing seems to work. The best result I have got so far was a gtk2 theme on gtk4 apps, not what I want though. I am using xorg and i3 wm.


Is it a pure-gtk4 application, or a libadwaita one?

For pure-gtk4, try to run gtk4-query-settings and check for the gtk-application-prefer-dark-theme key.

  • If it’s FALSE, then the setting could not be set from xsettings, so try to enforce it in the settings.ini:
# ~/.config/gtk-4.0/settings.ini
gtk-application-prefer-dark-theme = true
  • if it’s TRUE, then probably the application itself overwrites the setting (also the case when using libadwaita, see below)

Now, for libadwaita apps, the setting is by default read through xdg-portals, so you may need to install a portal interface like xdg-desktop-portal-gnome.
If you, like me, don’t use portals at all (I’m on Cinnamon), then you can set the environment variable ADW_DISABLE_PORTAL=1, in which case the dark theme setting will be read from gsettings, configure it as follow:

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

Tysm, the one thing I did not do was set the environment variable properly, I tried to use export - which did nothing. Instead I put it in /etc/environment. Libadwaita apps such as nautilus and endeavour now follow the correct theme.

1 Like

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