Repository navigation
Description
Type: Bug
When running vscode on Linux, vscode does not detect if the desktop environment changes from dark to light theme (or reverse), while vscode is running (at least on KDE Plasma).
This could be fixed by using the dbus library
https://github.com/Shouqun/node-dbus
to listening for a signal on dbus which tell us when the theme of the desktop changes.
Here is some simple javascript code as an example
bus.getInterface('org.freedesktop.portal.Desktop', '/org/freedesktop/portal/desktop', 'org.freedesktop.portal.Settings', function(err, iface) {
iface.on('SettingChanged', function(section, variable, value) {
if (section === "org.freedesktop.appearance") {
if (variable === "color-scheme") {
switch(value) {
case 0:
console.log("No preference");
break;
case 1:
console.log("Prefer dark appearance");
break;
case 2:
console.log("Prefer light appearance");
break;
default:
console.log("Error: Unknown theme preference");
break;
}
}
}
});
});Read more about the DBus signal here.
https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings
VS Code version: Code 1.76.2 (ee2b180, 2023-03-14T17:57:21.103Z)
OS version: Linux x64 6.1.20-1-lts
Modes:
Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 9 5900X 12-Core Processor (24 x 4552) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: disabled_software video_encode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | 1, 1, 1 |
| Memory (System) | 62.70GB (11.88GB free) |
| Process Argv | --extensions-dir=/home/dennis/.var/app/com.visualstudio.code/data/vscode/extensions --reuse-window --crash-reporter-id eeb15ef2-cf72-44d2-927d-b0d1bce07ef8 |
| Screen Reader | no |
| VM | 0% |
| DESKTOP_SESSION | plasma |
| XDG_CURRENT_DESKTOP | KDE |
| XDG_SESSION_DESKTOP | KDE |
| XDG_SESSION_TYPE | x11 |
Extensions (1)
| Extension | Author (truncated) | Version |
|---|---|---|
| copilot | Git | 1.79.10634 |
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vscaat:30438848
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
nodejswelcome1cf:30587006
3biah626:30602489
pyind779:30671433
f6dab269:30613381
pythonsymbol12:30671437
a9j8j154:30646983
pythonb192:30669360
azdwalk:30687957
pythonms35:30701012
Activity
vscodenpa commentedon Apr 7, 2023
Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.77.1. Please try upgrading to the latest version and checking whether this issue remains.
Happy Coding!
dvaerum commentedon Apr 7, 2023
Hey @VSCodeTriageBot I have run a quick test on vscode v1.77.1, which was installed and run from snap and I am still seeing the issue there vscode does not change the theme of the application of the desktop environment changes its theme.
aeschli commentedon Apr 11, 2023
We are relying on the Electron API to get notified on the theme change.
I see this reported here. I'm not sure why the Electron team didn't reopen the issue. Creating a new issue would be good.