Bug 511083

Summary: kde-gtk-config shouldn't set gtk-application-prefer-dark-theme
Product: [Applications] systemsettings Reporter: Ilya Fedin <fedin-ilja2010>
Component: kcm_styleAssignee: Plasma Bugs List <plasma-bugs-null>
Status: REPORTED ---    
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 11:09:30 UTC
SUMMARY
gtk-application-prefer-dark-theme is meant for the app itself to force dark mode, not for the desktop environment to tell whether the app should use dark mode, thus there's no way to force GTK to re-read its value.

The only proper way to switch GTK between light and dark theme is to let the user to set a light GTK theme and a dark GTK theme in the interface and then switch between them as needed.

A more stupid way is to add -dark to theme name when switching to dark color scheme like this GNOME extension (https://github.com/mukul29/legacy-theme-auto-switcher-gnome-extension/blob/09bb3cf10f8787c17f459af53fbc41d252876532/extension.js#L30-L40) is doing but there's no guarantee that the theme follows this naming scheme (although is likely to be right in most cases).

STEPS TO REPRODUCE
1. Switch Plasma to dark color scheme
2. Start a GTK3 app
3. Switch Plasma to light color scheme

OBSERVED RESULT
The app is still dark

EXPECTED RESULT
The app switches to light colors

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
Comment 1 Nate Graham 2025-10-25 15:51:36 UTC
If we did what you suggest, then GTK apps wouldn't automatically switch to dark mode when you change the KDE color scheme. That would be unexpected, I think.

How do you think we should handle that, if we implemented the suggestion?
Comment 2 Ilya Fedin 2025-10-26 04:36:51 UTC
I have enumerated two more proper alternatives right in the summary, did you read it?
Comment 3 Nate Graham 2025-10-27 19:55:54 UTC
Not very well, apparently. :/

But let's back up a bit. Can you clarify what exactly you mean by "Switch Plasma to dark color scheme"? Strictly speaking, you can't do this. You can switch the color scheme (which might affect Plasma, if it's a color-scheme-aware Plasma theme) or you can switch the Plasma theme (which doesn't affect the colors of any apps, KDE and GTK alike), or you can switch the global theme (which will affect all of them). Which one do you mean?
Comment 4 Ilya Fedin 2025-10-28 11:20:25 UTC
Switch colors or global theme in system settings, either should work. I was checking via colors.
Comment 5 Nate Graham 2025-10-29 14:58:38 UTC
And which apps are you testing with?
Comment 6 Ilya Fedin 2025-10-29 18:55:54 UTC
Any gtk3 application should suffice. You can check e.g. those provided by gtk itself (gtk3-demo, gtk3-widget-factory, etc).

And, well, if I run non-KDE Qt apps (like qBittorrent) with QT_QPA_PLATFORMTHEME=gtk3 set, they get affected by this, too... Looks like Qt does a good job of getting colors from GTK3 even repeating the bugged behavior.
Comment 7 Ilya Fedin 2025-11-10 20:55:22 UTC
Looks like GTK learned to follow system light/dark mode only 3 months ago (GTK 4.20+). Previously only libadiwata apps were supporting this. It reads org.freedesktop.appearance.color-scheme from portal and maps it to gtk-interface-color-scheme property in GtkSettings: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/8803

All previous GTK versions, including GTK 3, just have no support for this, with the best possible workaround of switching between GTK themes.