Skip to content

fix: use prefer-light and dconf for GTK4 color-scheme refresh (niri compatibility)#2141

Open
auricom wants to merge 1 commit intoAvengeMedia:masterfrom
auricom:fix/prefer-light-dconf-color-scheme
Open

fix: use prefer-light and dconf for GTK4 color-scheme refresh (niri compatibility)#2141
auricom wants to merge 1 commit intoAvengeMedia:masterfrom
auricom:fix/prefer-light-dconf-color-scheme

Conversation

@auricom
Copy link
Copy Markdown

@auricom auricom commented Apr 3, 2026

Fixes #2140

Summary

  • Replace "default" with "prefer-light" as the intermediate toggle value in refreshGTK4() — avoids ambiguity on compositors like niri where default may not trigger a style reload
  • Replace "default" with "prefer-light" in syncColorScheme() for light mode — explicit value is safer across environments
  • Add utils.DconfSet() which tries dconf write first (falling back to gsettings), and use it for all color-scheme writes — dconf is more universal and does not require GSettings schema setup (niri, NixOS, minimal distros)

Test plan

  • Apply theme in dark mode on niri — GTK4 apps should reload their color scheme
  • Apply theme in light mode on niri — GTK4 apps should reload their color scheme
  • Verify behavior is unchanged on a standard GNOME session
  • Verify dconf is tried before gsettings for color-scheme writes

🤖 Generated with Claude Code

Replace the intermediate 'default' toggle value with 'prefer-light' in
refreshGTK4() and syncColorScheme() to avoid ambiguity on compositors
like niri that don't treat 'default' the same as GNOME does.

Switch color-scheme writes to use dconf as the primary method (falling
back to gsettings), since dconf is more universally available and does
not require GSettings schema setup. This improves compatibility with
niri, NixOS, and other minimalistic environments where gsettings schemas
may not be configured.

Fixes: AvengeMedia#1643
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bbedward
Copy link
Copy Markdown
Collaborator

bbedward commented Apr 3, 2026

I was under the impression that prefer-light was more of a accessibility thing and the preferred preference for light mode was default, at least thats what I gained from yalter comments awhile back when we used to use prefer-light

@auricom
Copy link
Copy Markdown
Author

auricom commented Apr 4, 2026

I'm using Automatic Color Mode based on Location on DMS, and it works well. Every night, DMS and system applications switch to dark mode, and it switches to light mode during the day as expected.

However, my Flatpak applications (Zen, Vestkop, Zed, Vscode, Slack, etc...), all configured with themes synchronized with system, are staying in dark mode everytime.

The fix I found is to manually launch dconf write /org/gnome/desktop/interface/color-scheme '"prefer-dark"' or dconf write /org/gnome/desktop/interface/color-scheme '"prefer-light"' based on what time of the day it is ; because 'default' equals to 'prefer-dark' on my system.

I thought reading that comment that using default was not optimal compared to prefer-light, but I apologize if that's not the case.

Do you have an idea how I could manually trigger a script when DMS changes from dark to light ? I could fix this locally if upstream should stay like this.
Many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GTK4 color-scheme refresh fails on niri: use prefer-light and dconf instead of default/gsettings

2 participants