You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
autoDetectColorScheme doesn't follow live OS theme changes on Linux/KDE Wayland: bundled Electron's nativeTheme.shouldUseDarkColors stays stale #340485
On Linux (KDE Plasma 6, Wayland), window.autoDetectColorScheme picks the correct theme at startup but never follows OS light/dark changes while VS Code is running. The root cause appears to be the Electron build bundled with VS Code: nativeTheme emits updated events, but shouldUseDarkColors keeps returning the value read at startup. Upstream Electron of the same version, running the same test code, tracks the change correctly.
Environment
VS Code 1.141.0 (2a59476), x64, Electron 43.7.7. Also reproduced with 1.140.0 (Electron 43.7.3) and 1.139.1 (Electron 43.6.0)
Manjaro Linux, kernel 6.18.49
KDE Plasma 6.7.4, Wayland session (--ozone-platform=wayland)
Start VS Code with --user-data-dir <empty dir> --disable-extensions and "window.autoDetectColorScheme": true.
Switch the Plasma color scheme from light to dark (or the other way).
VS Code keeps the theme it started with. Reloading the window does not help, only a full restart does.
What I verified
The portal works.org.freedesktop.portal.Settings.SettingChanged is emitted with org.freedesktop.appearance color-scheme = 1/2 on every switch (checked with dbus-monitor). gsettings color-scheme and GTK gtk-application-prefer-dark-theme are updated too.
VS Code receives the event but reads a stale value. With the Main log at Debug, every switch logs [theme main service] electron.nativeTheme: themeSource=system, shouldUseDarkColors=false ..., and the value never changes.
The difference is the Electron binary. A minimal Electron app (BrowserWindow + nativeTheme.on('updated') printing shouldUseDarkColors) behaves differently depending on which binary runs it:
Arch Linux electron43 43.6.0 and electron39: the value flips correctly on every switch, with or without a window, and also with all of VS Code's switches (--enable-features=...GlobalShortcutsPortal..., --disable-features=..., --xdg-portal-required-version=4).
The VS Code 1.139.1 binary (same Electron version 43.6.0), running the same app from resources/app: updated fires on every switch, but shouldUseDarkColors stays at the startup value. Changing the GTK theme or color-scheme through gsettings does not update it either.
Sample output from both binaries running at the same time, while switching dark → light → dark:
nativeTheme.shouldUseDarkColors follows the XDG portal color-scheme at runtime, as it does in upstream Electron, so window.autoDetectColorScheme switches the theme live.
Same behavior on GNOME, so this doesn't look KDE-specific.
Environment:
Fedora 44, GNOME 50, Wayland
VS Code 1.144.0 (RPM), Electron 43.8.3, Chrome 150.0.7871.250
window.autoDetectColorScheme: true
What I verified:
gsettings monitor shows clean single color-scheme transitions
(prefer-light / prefer-dark), no bouncing.
xdg-desktop-portal emits SettingChanged for org.freedesktop.appearance
color-scheme (uint32 1 / 2) correctly on every switch.
Firefox follows the change immediately.
In VS Code DevTools, a matchMedia('(prefers-color-scheme: dark)')
change listener fires "dark? true" and then flips back to
"dark? false" shortly after, so the renderer does receive the change
but ends up on the wrong value. Occasionally it resolves correctly,
so it looks like a race rather than a constant failure.
Reproduces with the same behavior in another Electron app (Claude
Desktop), so it is not VS Code specific.
Happy to provide logs (Main log at Debug) if useful.
Activity
volkenrock commentedon Oct 31, 2026
Same behavior on GNOME, so this doesn't look KDE-specific.
Environment:
What I verified:
(prefer-light / prefer-dark), no bouncing.
color-scheme (uint32 1 / 2) correctly on every switch.
change listener fires "dark? true" and then flips back to
"dark? false" shortly after, so the renderer does receive the change
but ends up on the wrong value. Occasionally it resolves correctly,
so it looks like a race rather than a constant failure.
Desktop), so it is not VS Code specific.
Happy to provide logs (Main log at Debug) if useful.