[BUG] Desktop Linux: theme follows system light/dark one switch behind (still present in 2.26454.0, follow-up to #79995)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Follow-up to #79995, which was closed by the inactivity bot. The bug is still present in Claude Desktop 2.26454.0 (Electron 44.4.3).
With Appearance = "Match system", the app does not follow the OS light/dark switch while it runs. On KDE Plasma Wayland it is always one switch behind: at the switch to dark it stays light (or turns light), at the switch to light it turns dark. A restart always shows the correct theme.
What I verified on Fedora 44, KDE Plasma 6.7.5 Wayland, xdg-desktop-portal 1.22.1 with the KDE and GTK backends:
- The portal is correct and on time.
dbus-monitorshowsSettingChangedfororg.freedesktop.appearance/color-schemewith the right value (1 or 2) at the moment of each switch. - A plain Electron 44.4.3 app (same version as Claude Desktop,
nativeTheme.themeSource = 'system', hiddenBrowserWindow) shows the same fault.nativeTheme.on('updated')fires at the portal signal, but bothnativeTheme.shouldUseDarkColorsandmatchMedia('(prefers-color-scheme: dark)')in the page return the previous mode, and stay there until the next event. Same result with--gtk-version=4. - Electron reads the GTK theme colors when the signal arrives, before kde-gtk-config has rewritten
~/.config/gtk-3.0/colors.css. A GTK theme reload a few seconds after the switch (gsettings set org.gnome.desktop.interface gtk-theme Adwaita, then back toBreeze) makes Electron fireupdatedagain, now with the correct value. The probe app then follows correctly.
This matches the open upstream bug electron/electron#48736 (runtime theme resolution wrong on KDE Wayland since the Chromium 142 native theme refactor).
What Should Happen?
With "Match system", the app should apply the new theme at once, in both directions, without a restart.
Suggested fix (same as in #79995): on Linux, read org.freedesktop.appearance / color-scheme from the settings portal in the main process and set nativeTheme.themeSource to dark or light from it, instead of trusting nativeTheme with themeSource = 'system'. The portal value is correct and instant on the same bus.
Error Messages/Logs
none
Steps to Reproduce
- Start Claude Desktop on KDE Plasma Wayland in light mode, Appearance = "Match system".
- Switch to dark:
plasma-apply-colorscheme BreezeDark. The app stays light. - Switch to light:
plasma-apply-colorscheme BreezeLight. The app turns dark. - Restart the app: correct theme.
Workaround for other users: after each switch, wait about 5 seconds, then rungsettings set org.gnome.desktop.interface gtk-theme Adwaita; sleep 0.5; gsettings set org.gnome.desktop.interface gtk-theme Breeze
Claude Model
Other
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.292 (Claude Code); Claude Desktop 2.26454.0
Platform
Other
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
Fedora 44, KDE Plasma 6.7.5 (Wayland), Claude Desktop 2.26454.0 (official .deb repackaged as RPM, no changes), Electron 44.4.3, xdg-desktop-portal 1.22.1, xdg-desktop-portal-kde 6.7.5, gtk3 3.24.52. Desktop app UI only, not the CLI.