Dark mode for KDE/Qt apps: write kdeglobals colors and set QT_QPA_PLATFORMTHEME
CI / test (push) Failing after 17s

KWrite stayed light with the Dark mode switch on. KDE apps read their colors
from the [Colors:*] groups of kdeglobals, not from the scheme's name, and the
switch only set [General] ColorScheme with kwriteconfig. Qt 6 apps also had no
platform theme under XDG_CURRENT_DESKTOP=chandra, so Qt reported an unknown
(light) color scheme whatever the portal said, and KDE Frameworks 6 apps
picked Breeze Light.

- session/chandra-kde-colors dark|light copies the scheme's color groups into
  kdeglobals (counterpart of the current scheme, else Breeze, else Chandra's
  own ChandraDark/ChandraLight) and emits KGlobalSettings.notifyChange so
  running apps repaint. The compositor calls it from the switch.
- chandra-session sets QT_QPA_PLATFORMTHEME to kde (plasma-integration) or
  xdgdesktopportal when unset, and passes it to the activation environment.
- install.py installs the script and the two color schemes.
- scripts/test-kde-colors.sh tests the rewriting, and that a running KWrite
  turns dark live; docs/dark-mode.md explains it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hjmk6mgq6Gg5vgKfMp
This commit is contained in:
Claude committed 2026-11-25 22:33:29 +00:00
1 parent 114f0b4e04
commit 42aa770452
8 files changed
+523 -12

No files matched your search

+10
View File
@@ -23,6 +23,10 @@ Installs:
/usr/local/bin/chandra-root run one graphical app as root in the session (run0)
/usr/local/bin/chandra-ctl talk to the running session: `chandra-ctl reload` loads
the panel modules again (docs/reloading.md)
/usr/local/bin/chandra-kde-colors Dark mode for KDE/Qt apps: copies a color scheme into
kdeglobals (docs/dark-mode.md)
/usr/local/share/color-schemes/Chandra{Dark,Light}.colors KDE color schemes, used when Breeze's
aren't installed
/usr/local/share/chandra/{config,wit,assets}/ files the compositor reads at runtime
/usr/local/share/chandra/modules/*.wasm the panel's wasm modules (build them first: just modules)
/usr/share/wayland-sessions/chandra.desktop display-manager entry
@@ -48,6 +52,9 @@ targets = [
"/usr/local/bin/chandra-session",
"/usr/local/bin/chandra-root",
"/usr/local/bin/chandra-ctl",
"/usr/local/bin/chandra-kde-colors",
"/usr/local/share/color-schemes/ChandraDark.colors",
"/usr/local/share/color-schemes/ChandraLight.colors",
"/usr/share/wayland-sessions/chandra.desktop",
"/usr/share/xdg-desktop-portal/portals/chandra.portal",
"/usr/share/xdg-desktop-portal/chandra-portals.conf",
@@ -132,6 +139,9 @@ if not native:
install(os.path.join(root, "session/chandra-session"), "/usr/local/bin/chandra-session")
install(os.path.join(root, "session/chandra-root"), "/usr/local/bin/chandra-root")
install(os.path.join(root, "session/chandra-ctl"), "/usr/local/bin/chandra-ctl")
install(os.path.join(root, "session/chandra-kde-colors"), "/usr/local/bin/chandra-kde-colors")
for f in ("ChandraDark.colors", "ChandraLight.colors"):
put(os.path.join(root, "session/color-schemes", f), "/usr/local/share/color-schemes/" + f, 0o644)
# The display-manager entry stays a real file: some managers don't follow symlinks there.
put(os.path.join(root, "session/chandra.desktop"), "/usr/share/wayland-sessions/chandra.desktop", 0o644)
# xdg-desktop-portal reads backends only from /usr/share (or $XDG_DESKTOP_PORTAL_DIR), not