Dark mode sets the system preference for apps: GTK, browsers, Qt and KDE
CI / test (push) Failing after 16s

In the login session (--drm) the settings module's Dark mode switch, and the saved choice at
startup, now also set what other programs follow (compositor/host/system_theme.mbt):

- gsettings org.gnome.desktop.interface color-scheme prefer-dark|default: the portal's
  org.freedesktop.appearance color-scheme, followed by Chrome/Chromium, Electron, Firefox,
  GTK 4 / libadwaita and Qt 6.5+;
- gtk-theme Adwaita <-> Adwaita-dark for GTK 3 (only when it is one of those two);
- gtk-application-prefer-dark-theme in gtk-3.0 and gtk-4.0 settings.ini;
- KDE color scheme BreezeDark|BreezeLight via plasma-apply-colorscheme, else kwriteconfig6/5
  (kdeglobals [General] ColorScheme);
- qt6ct/qt5ct: a *-light / *-dark color file is swapped for its counterpart when it exists.

Missing tools are skipped. Nested windows and tests leave the system alone
(ChandraCompositor::sync_system_theme, set from --drm).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hgxf6exeYrDGcy4WW3
This commit is contained in:
Claude committed 2026-11-25 18:57:46 +00:00
1 parent f2e870c251
commit a7909014b8
3 files changed
+107 -1

No files matched your search

+7 -1
View File
@@ -35,6 +35,9 @@ pub(all) struct ChandraCompositor {
/// The theme in use: `dark_theme` (the configured one) or Moon Day, per the Dark mode setting.
mut theme : @scene.ThemeTokens
dark_theme : @scene.ThemeTokens
/// Also set the system-wide dark/light preference for apps (system_theme.mbt). The login
/// session turns it on; nested windows and tests leave it off.
mut sync_system_theme : Bool
mut output_w : Int
mut output_h : Int
mut work_area : @wm.Rect
@@ -111,6 +114,7 @@ pub fn ChandraCompositor::new(
wm,
theme,
dark_theme: theme,
sync_system_theme: false,
output_w,
output_h,
work_area,
@@ -968,12 +972,14 @@ fn ChandraCompositor::activate_task(self : ChandraCompositor, wid : UInt64) -> U
}
///| Use the dark (configured) or the light theme, as the shell's Dark mode setting says, for the
/// shell, the panel modules, the window decorations and the switcher; redraws everything.
/// shell, the panel modules, the window decorations and the switcher; redraws everything, and
/// (in the login session) tells apps through the system preference.
pub fn ChandraCompositor::apply_theme(self : ChandraCompositor) -> Unit {
let t = if self.shell.dark_mode { self.dark_theme } else { @scene.ThemeTokens::moon_day() }
self.theme = t
self.shell.set_output(t, self.output_w, self.output_h)
self.damage.mark_full()
self.sync_system_theme_pref(self.shell.dark_mode)
}
///| Carry out what panel modules asked for: focus a window, switch layout.