Chrome follows the Dark mode switch: Chandra serves the portal's color-scheme
CI / test (push) Failing after 17s

Chrome (and Firefox, Electron, GTK 4, Qt 6) read dark/light from xdg-desktop-portal's Settings
interface. With XDG_CURRENT_DESKTOP=chandra and no chandra-portals.conf, xdg-desktop-portal found
no Settings backend (gtk/gnome are UseIn=gnome, kde is UseIn=KDE) and exported no Settings
interface at all, so the gsettings color-scheme a790901 sets never reached Chrome.

- compositor/portal: the compositor is an org.freedesktop.impl.portal.Settings backend
  (org.freedesktop.impl.portal.desktop.chandra on the session bus): Read/ReadAll of
  org.freedesktop.appearance color-scheme (1 dark, 2 light), SettingChanged when the switch flips,
  version property, introspection. Login session only; the main loop wakes on its socket.
- compositor/network/dbus.mbt: serve calls (on_call, reply, reply_error), emit and receive
  signals, sender field, session bus address.
- session/chandra.portal + chandra-portals.conf, installed to /usr/share/xdg-desktop-portal by
  install.py: Settings from chandra first, then gtk/kde/gnome; other portals from gtk/kde/gnome.
- chandra-session restarts a running xdg-desktop-portal so it reads the config for this desktop.
- scripts/test-portal-dbus.sh: end to end behind the real xdg-desktop-portal on a private bus
  (ReadOne gives 1, flipping gives SettingChanged 2). docs/dark-mode.md: how to check it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhkztRQM7vcSuHX4bB
This commit is contained in:
Claude committed 2026-11-25 20:30:30 +00:00
1 parent c7a6c8376e
commit 005e11e7bf
14 files changed
+739 -5

No files matched your search

+9
View File
@@ -78,6 +78,15 @@ if command -v dbus-update-activation-environment >/dev/null 2>&1; then
XDG_SESSION_DESKTOP >>"$log" 2>&1 || true
fi
# xdg-desktop-portal picks its backends once, at start, from $XDG_CURRENT_DESKTOP (here
# chandra-portals.conf: the compositor answers apps' dark/light question). One still running from
# an earlier session (systemd keeps the user's services between logins) would keep another
# desktop's choice, so Chrome and Firefox would not follow the Dark mode switch: restart it if it
# is running. Apps start it on demand otherwise.
if command -v systemctl >/dev/null 2>&1; then
systemctl --user try-restart xdg-desktop-portal.service >>"$log" 2>&1 || true
fi
# Hand the PAM-started keyring daemon (already unlocked by the login password) its session
# components, so it owns org.freedesktop.secrets on our bus. Harmless if it isn't installed,
# already running under systemd's socket units, or not unlocked by PAM (it then prompts once).