AvengeMedia / AvengeMedia/DankMaterialShell

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

Open
#2,140 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
QML
Stars
8.1k
Forks
515
Avg merge
1d 8h
Merged PRs (30d)
102

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`:

```go
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.