Skip to content

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

@auricom

Description

@auricom

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 in refreshGTK4() and as the scheme value in syncColorScheme() for light mode.
  • Add a DconfSet utility that tries dconf write first (falling back to gsettings), and use it for all color-scheme writes.

A pull request with the fix is attached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions