Repository navigation
Description
I'm on CachyOS using niri and DankMaterialShell. system_dark returns true even when I'm on light mode.
I can reproduce this with Hex. It's always in Dark mode.
Claude's investigation and research is below.
What happens
On Linux, an app that follows the system can't draw light on a light GNOME-style desktop. The desktop portal answers org.freedesktop.appearance color-scheme with 0 (no preference), and Rune resolves 0 the same way it resolves no portal at all: Cx::system_dark() is true and the window draws dark. The app can't tell that the portal answered.
A light desktop usually answers 0, not 2. GNOME Settings > Appearance has two styles, Default and Dark. Default writes color-scheme 'default' (cc-background-panel.c, on_color_scheme_toggle_active_cb), and the portal reports that as 0. libadwaita draws app windows light at 0: an app's default scheme is PREFER_LIGHT, "Use light appearance unless the system prefers dark colors" (adw-style-manager.c, AdwColorScheme). So on stock GNOME every other app window is light, and a Rune window that follows the system is dark.
0 → dark is deliberate, and I'm not asking to flip it everywhere. #40 kept it ("color-scheme 0 (no preference), no portal or no session bus keep dark"). Hokum reads 0 as dark "like the rest of Hokum" (bus.rs#L615-L635). Hex's tray keeps its white mark at 0 (tray.rs#L108-L110). Those are good defaults for cards, HUDs and tray marks. The gap is an app window that wants to match the desktop's other windows: no Rune API tells it the desktop is in GNOME's Default style.
Where
At dev 79fed3b5:
- portal_appearance.rs#L22-L23: in
SCHEME, 0 means both "answered no preference" and "not known yet". - portal_appearance.rs#L41-L47:
scheme_darkmaps 0 toNone, the same as no answer. - preferences.rs#L83-L98:
window_darkturnsNoneinto dark (unwrap_or(true), line 96), andCx::system_dark()is a plainbool.
Repro
- On GNOME, pick Default in Settings > Appearance (
color-scheme'default'). - Read the portal:
It prints
gdbus call --session --dest org.freedesktop.portal.Desktop \ --object-path /org/freedesktop/portal/desktop \ --method org.freedesktop.portal.Settings.ReadOne org.freedesktop.appearance color-scheme(<uint32 0>,). - Open an app whose Auto theme is
cx.system_dark(), such asexamples/settingson Auto. It draws dark next to light GTK windows.
I saw steps 2 and 3 with my own app on niri with DankMaterialShell in light mode, which leaves color-scheme at 'default' as GNOME's Default does. Step 2's output above is verbatim. I have not run examples/settings itself.
Proposed fix (additive; no app's output changes)
Let an app see the desktop's answer before the dark fallback, for example:
/// The desktop's stated preference: Some(true) dark, Some(false) light, None when it
/// states none (portal `color-scheme` 0) or nothing answers. `system_dark` is unchanged.
pub fn desktop_dark(&self) -> Option<bool>An app that wants GNOME's behaviour writes cx.desktop_dark().unwrap_or(false). Hokum, Hex and every existing app keep drawing what they draw today.
Notes:
Envis on the list of types apps build as literals, so this can't be a newEnvfield. Since Linux: follow the desktop's light or dark preference through the XDG portal #40, a window rereads the portal on each redraw. It could keep theOptionbesidesystem_darkthere, and aCxmethod could read it.- If you'd rather make it a choice than an accessor, an
Appbuilder method for what 0 means (default: dark, as now) does the same job. - Changing
window_dark's default for windows only (0 → light; overlays keep dark) would also fix it. That's your call, since it changes what existing apps draw on GNOME.
Workaround
None inside Rune. An app can read the portal itself, as Hokum's follow_color_scheme does. A user can run gsettings set org.gnome.desktop.interface color-scheme prefer-light, which makes the portal answer 2 (per #40's testing). I didn't try that here, and it leaves neither style selected in GNOME Settings.
Environment
CachyOS (Arch), niri 26.04, DankMaterialShell in light mode with its portal sync on, xdg-desktop-portal 1.22.1 with the gnome (51.0) and gtk (1.15.3) backends, Rune 79fed3b5 (dev).
Happy to recheck on a dev rev with the change.
Done when: on a desktop whose portal answers color-scheme 0, an app can find out that the desktop stated no preference (and so draw light, as libadwaita does), while apps that don't ask draw exactly what they draw today.
Activity
Hona commentedon Nov 23, 2026
Fixed on
devin #1743 (23edd141).In
crates/rune/src/platform/portal_appearance.rs, an XDG desktop portalorg.freedesktop.appearancecolor-schemereply of0("no preference", which GNOME's Default style and light-mode shells send) was conflated with an unanswered portal, soCx::system_dark()fell back to dark and switching from dark (1) back to default (0) did not update. Chromium (ui/linux/portal_settings_linux.cc,SetColorScheme), Firefox (widget/gtk/nsLookAndFeel.cpp), and libadwaita (src/adw-style-manager.c) all treat only1as dark and resolve0and2to light once the portal answers, reserving the fallback for when no portal answers. Rune now separates the unanswered state from answered0/2(light) and1(dark), soCx::system_dark()isfalsewhen the portal answers0while unreachable portals still fall back to dark.