Bug 511081

Summary: kde-gtk-config color scheme value is desync with xdg-desktop-portal-kde
Product: [Applications] systemsettings Reporter: Ilya Fedin <fedin-ilja2010>
Component: kcm_styleAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: mail, nate
Priority: NOR    
Version First Reported In: 6.4.5   
Target Milestone: ---   
Platform: NixOS   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Ilya Fedin 2025-10-25 10:56:09 UTC
SUMMARY
When switching from dark to light theme, xdg-desktop-portal-kde emits SettingChanged with color-scheme set to 2 (prefer light). kde-gtk-config sets org.gnome.desktop.interface.color-scheme to 0 which makes xdg-desktop-portal-gtk to emit SettingChanged with color-scheme set to 0 (no preference). xdg-desktop-portal-gtk emits later thus applications use its value.

STEPS TO REPRODUCE
1. Switch Plasma to a dark color scheme and back

OBSERVED RESULT
SettingChanged is first emitted with 2, then 0

EXPECTED RESULT
SettingChanged is emitted both times with 2

SOFTWARE/OS VERSIONS
Operating System: NixOS 25.11
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.18.0
Qt Version: 6.9.2
Kernel Version: 6.17.0-cachyos (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 5950X 16-Core Processor
Memory: 64 ГиБ of RAM (62.7 ГиБ usable)
Graphics Processor: AMD Radeon RX 6400
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C94
System Version: 1.0

ADDITIONAL INFORMATION
I believe xdg-desktop-portal is at fault too due to not checking which impl is responsible for the setting before forwarding the signal and I made a bug report for it too (https://github.com/flatpak/xdg-desktop-portal/issues/1842) but I don't know how fast they will fix it or will they fix it at all thus I believe it would be a good idea to synchronize the values.
Comment 1 Bug Janitor Service 2025-10-31 19:49:09 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kde-gtk-config/-/merge_requests/137
Comment 2 Ilya Fedin 2025-10-31 21:18:36 UTC
Git commit 3ffc9bff69efd8cac6bacef2caac5903ca287855 by Ilya Fedin.
Committed on 31/10/2025 at 19:47.
Pushed by nicolasfella into branch 'master'.

Use prefer light in light mode

Changing org.gnome.desktop.interface.color-scheme leads to xdg-desktop-portal-gtk issuing SettingChanged for org.freedesktop.appearance.colo-scheme, which in turn gets forwarded by xdg-desktop-portal and applications use no preference mode instead of the prefer light mode suggested by xdg-desktop-portal-kde.

Doing the same as xdg-desktop-portal-kde avoids the issue.

M  +1    -1    kded/gtkconfig.cpp

https://invent.kde.org/plasma/kde-gtk-config/-/commit/3ffc9bff69efd8cac6bacef2caac5903ca287855
Comment 3 Nicolas Fella 2025-10-31 21:19:44 UTC
Git commit b4fdff4d365035460a0f915cf7a458708a1305b3 by Nicolas Fella, on behalf of Ilya Fedin.
Committed on 31/10/2025 at 21:19.
Pushed by nicolasfella into branch 'Plasma/6.5'.

Use prefer light in light mode

Changing org.gnome.desktop.interface.color-scheme leads to xdg-desktop-portal-gtk issuing SettingChanged for org.freedesktop.appearance.colo-scheme, which in turn gets forwarded by xdg-desktop-portal and applications use no preference mode instead of the prefer light mode suggested by xdg-desktop-portal-kde.

Doing the same as xdg-desktop-portal-kde avoids the issue.
(cherry picked from commit 3ffc9bff69efd8cac6bacef2caac5903ca287855)

M  +1    -1    kded/gtkconfig.cpp

https://invent.kde.org/plasma/kde-gtk-config/-/commit/b4fdff4d365035460a0f915cf7a458708a1305b3