-
-
Notifications
You must be signed in to change notification settings - Fork 348
GTK4 color-scheme refresh fails on niri: use prefer-light and dconf instead of default/gsettings #2140
Description
Problem
Experienced this on my local setup (DMS + Niri), the GTK4 color-scheme refresh introduced in #1643 does not work correctly.
default as intermediate toggle value
refreshGTK4() currently toggles through default when the current scheme is prefer-dark:
if current == "prefer-dark" {
toggle = "default" // ← problematic
} else {
toggle = "prefer-dark"
}It seems on niri, default is not treated the same as on GNOME — it may not trigger the GTK4 style reload that the toggle is meant to force. Using prefer-light as the intermediate value is explicit and unambiguous, and produces the same toggling effect.
dconf write is more universal: it writes directly to the DConf database without needing schema definitions, and is available on virtually any system that runs GTK apps.
This was already noted in the comments on #1643:
Now that I think about it, we should use
dconf write /org/gnome/desktop/interface/color-scheme '"prefer-light"'instead of gsettings, because it is an "universal" way of doing it. For example, in NixOS it is a pain to setup gsettings schemas, and some minimalistic distro won't include it, however dconf probably is universal, or at least much more common.
Proposed Fix
- Replace
"default"with"prefer-light"as the intermediate toggle value inrefreshGTK4()and as the scheme value insyncColorScheme()for light mode. - Add a
DconfSetutility that triesdconf writefirst (falling back togsettings), and use it for allcolor-schemewrites.
A pull request with the fix is attached.