Bug 421745

Summary: On Wayland, the color scheme of gtk3 apps is not fully updated when changing global themes in Global Theme KCM (Quick Settings and Colors KCMs are unaffected)
Product: [Applications] systemsettings Reporter: Patrick Silva <bugseforuns>
Component: kcm_lookandfeelAssignee: medin <med.medin.2014>
Status: RESOLVED FIXED    
Severity: normal CC: 4wy78uwh, agrinev98, antonioni.rocha, arealperson1234+kde, damikope, dev.bacteriostat, ferenosdev, filippo27998, kde, kdedev, m.weghorn, mail, med.medin.2014, michal.dybczak, mohan.ram, nate, peter, pieterkristensen, postix, qydwhotmail, samuelsumukhreddy, seqularise, uhhadd, wachidadinugroho.maya
Priority: NOR Keywords: wayland
Version: 5.27.4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Firefox and Thunderbird not applying gtk theme
Changing global theme

Description Patrick Silva 2020-05-18 21:36:16 UTC
I can reproduce this issue on Arch (Plasma 5.19 beta) and neon unstable changing from Breeze to Breeze Dark global theme and vice-versa.

STEPS TO REPRODUCE
1. have some gtk3 app(s) installed on your system (I have nautilus and Gnome disks)
2. set a global theme with a color scheme opposite to your current one (if you are using a light color scheme, set a global theme with dark color scheme and vice-versa)
3. open the gtk3 app(s) installed on your system: notice that the color scheme
of the global theme set in the step 2 was not applied to the gtk3 app(s)
4. restart Plasma session
5. open the same gtk3 app(s): now the color scheme of the gtk3 app(s) is correct

EXPECTED RESULT
color scheme of gtk3 apps should be immediately updated after we change the global theme

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.18.90
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0 rc2
Kernel Version: 5.6.13-arch1-1

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.71.0
Qt Version: 5.14.2
Comment 1 Seqularise 2020-07-07 16:09:58 UTC
I found a "solution" to this on reddit, restart the gtk settings service in plasma and then restart gtk application, it will get the new color scheme.
Comment 2 Bug Janitor Service 2020-07-07 18:37:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/55
Comment 3 Nate Graham 2020-07-07 23:27:56 UTC
Git commit 755e546019b5a9e82652ed5b5d10cd5b75340361 by Nate Graham, on behalf of Mikhail Zolotukhin.
Committed on 07/07/2020 at 23:27.
Pushed by ngraham into branch 'master'.

Notify about changes when changing Global Theme

This is needed for GTK Daemon to correctly change various GTK settings
as well (e.g. icon theme, colors, etc).

M  +6    -6    kcms/lookandfeel/kcm.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/755e546019b5a9e82652ed5b5d10cd5b75340361
Comment 4 Nate Graham 2020-07-07 23:28:29 UTC
Git commit 24211d51b223c1bb30a86f2c83a2331022dc8b69 by Nate Graham, on behalf of Mikhail Zolotukhin.
Committed on 07/07/2020 at 23:28.
Pushed by ngraham into branch 'Plasma/5.19'.

Notify about changes when changing Global Theme

This is needed for GTK Daemon to correctly change various GTK settings
as well (e.g. icon theme, colors, etc).


(cherry picked from commit 755e546019b5a9e82652ed5b5d10cd5b75340361)

M  +6    -6    kcms/lookandfeel/kcm.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/24211d51b223c1bb30a86f2c83a2331022dc8b69
Comment 5 Patrick Silva 2020-07-28 16:58:21 UTC
This bug is still reproducible even with a new user account after update to Plasma 5.19.4 and reboot.

Operating System: Arch Linux
KDE Plasma Version: 5.19.4
KDE Frameworks Version: 5.72.0
Qt Version: 5.15.0
Comment 6 Mikhail Zolotukhin 2020-07-28 17:34:58 UTC
For me colors are changing partially, when changing global theme. No idea why this happens, so I can't really fix it.
Comment 7 Patrick Silva 2020-07-28 18:34:18 UTC
Thank you for your effort anyway Mikhail.  :)
Comment 8 The Feren OS Dev 2020-08-28 23:54:26 UTC
I can confirm this over here on KDE neon as well.
Comment 9 Mikhail Zolotukhin 2020-09-19 16:47:13 UTC
*** Bug 426727 has been marked as a duplicate of this bug. ***
Comment 10 Patrick Silva 2020-11-15 12:37:22 UTC
*** Bug 429129 has been marked as a duplicate of this bug. ***
Comment 11 Bug Janitor Service 2021-01-28 11:21:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kde-gtk-config/-/merge_requests/23
Comment 12 David Redondo 2021-01-28 11:32:41 UTC
Git commit a197df2c71c5160e87f14bb09e35b53b116b1a41 by David Redondo.
Committed on 28/01/2021 at 11:13.
Pushed by davidre into branch 'master'.

Use the same configs for watching and reading

KColorScheme uses KSharedConfig::openConfig() when no config is specified,
we were watching a KSharedConfig::openConfig("kdeglobals") which seemingly
is not updated instantly because it technically is different even though
effectively it's the same config. Watching the same configs solves the theme
not updating when the global theme is switched
FIXED-IN:5.21

M  +1    -1    kded/configvalueprovider.cpp
M  +1    -1    kded/gtkconfig.cpp

https://invent.kde.org/plasma/kde-gtk-config/commit/a197df2c71c5160e87f14bb09e35b53b116b1a41
Comment 13 David Redondo 2021-01-28 11:33:24 UTC
Git commit 7e61802bb179f53e0e785109ce7ab35d9b5dec54 by David Redondo.
Committed on 28/01/2021 at 11:33.
Pushed by davidre into branch 'Plasma/5.21'.

Use the same configs for watching and reading

KColorScheme uses KSharedConfig::openConfig() when no config is specified,
we were watching a KSharedConfig::openConfig("kdeglobals") which seemingly
is not updated instantly because it technically is different even though
effectively it's the same config. Watching the same configs solves the theme
not updating when the global theme is switched
FIXED-IN:5.21


(cherry picked from commit a197df2c71c5160e87f14bb09e35b53b116b1a41)

M  +1    -1    kded/configvalueprovider.cpp
M  +1    -1    kded/gtkconfig.cpp

https://invent.kde.org/plasma/kde-gtk-config/commit/7e61802bb179f53e0e785109ce7ab35d9b5dec54
Comment 14 Patrick Silva 2021-06-25 19:00:15 UTC
Can reproduce this bug again on neon unstable.

 Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.22.80
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.3
Graphics Platform: X11
Comment 15 Nate Graham 2021-10-19 21:45:40 UTC
*** Bug 444027 has been marked as a duplicate of this bug. ***
Comment 16 PK 2022-01-14 12:13:38 UTC
Also on Neon User Edition I have exactly this experience. Thunderbird and Firefox both do not follow changes in the color scheme. In my experience it's best to wipe the ~/.config/gtk-3.0 and ~/.config/gtk-4.0 folders then choose the new color scheme and then immediately after that reboot. 
Operating System: KDE neon 5.23
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.89.0
Qt Version: 5.15.3
Kernel Version: 5.11.0-46-generic (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Celeron® J4105 CPU @ 1.50GHz
Memory: 7.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 600
Comment 17 PK 2022-01-15 08:31:45 UTC
To elaborate a little about comment 16...
I switched from the Lightly application theme to Breeze (Evolution) because I liked it so much. Since then changing colors and also global themes is broken between qt and gtk apps.
As an experiment I re-installed the Lightly theme and changed colors and global themes to see what Thunderbird and Firefox would do. They reacted completely as they should!
In am no more than an enthusiastic KDE user but my guess is that the fact that this bug came back has to do with the introduction of the new Breeze theme...
Comment 18 Nate Graham 2022-04-18 14:39:49 UTC
*** Bug 451367 has been marked as a duplicate of this bug. ***
Comment 19 Nate Graham 2022-04-18 14:41:09 UTC
This affects the Global Themes KCM as well as the Quick Settings page which does the same thing.
Comment 20 Nate Graham 2022-04-19 15:34:05 UTC
*** Bug 448044 has been marked as a duplicate of this bug. ***
Comment 21 Nate Graham 2022-04-19 15:35:37 UTC
*** Bug 417463 has been marked as a duplicate of this bug. ***
Comment 22 Nate Graham 2022-04-19 15:35:44 UTC
*** Bug 438182 has been marked as a duplicate of this bug. ***
Comment 23 KDamian 2022-05-04 20:01:43 UTC
I can still reproduce on 5.25.4:

Operating System: Fedora Linux 36
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3
Kernel Version: 5.17.5-300.fc36.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-2520M CPU @ 2.50GHz
Memory: 7.7 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 3000
Comment 24 David Redondo 2022-07-25 11:10:44 UTC
> This affects the Global Themes KCM as well as the Quick Settings page which does the same thing.

Probably misses writing with Notify
Comment 25 David Redondo 2022-07-25 11:15:09 UTC
Actually cannot reproduce, firefox changes color instantly when using the global theme kcm
Comment 26 postix 2022-07-25 11:26:22 UTC
(In reply to David Redondo from comment #25)
> Actually cannot reproduce, firefox changes color instantly when using the global theme kcm

Firefox 102 works fine for me too.

However, in case of other GTK apps such as Thunderbird, Gajim, Dino for instance, only the color of the  (non CSD) title bar changes on changing the global theme.
The rest of the UI first change when setting a different GTK theme under "Configure Application Style --> GNOME/GTK Application Style".

I'm on Plasma 5.25.3 (openSUSE TW)
Comment 27 KDamian 2022-07-25 11:40:05 UTC
(In reply to David Redondo from comment #25)
> Actually cannot reproduce, firefox changes color instantly when using the
> global theme kcm

I am not sure, but I seem to recall Firefox is actually picking up on the "dark/light mode" standard now (as in Freedesktop standard), and adjusting itself to its value, so that may be why it is not affected (just a theory though).
Comment 28 David Redondo 2022-07-25 11:44:18 UTC
Hmm yes gedit doesn't change while it works from colors kcm.
Comment 29 KDamian 2022-07-25 11:46:08 UTC
(In reply to KDamian from comment #27)
> (In reply to David Redondo from comment #25)
> > Actually cannot reproduce, firefox changes color instantly when using the
> > global theme kcm
> 
> I am not sure, but I seem to recall Firefox is actually picking up on the
> "dark/light mode" standard now (as in Freedesktop standard), and adjusting
> itself to its value, so that may be why it is not affected (just a theory
> though).

Sorry, I misremembered the chain of messages, feel free to ignore my previous comment. :)
Comment 30 Bug Janitor Service 2022-07-25 14:09:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1961
Comment 31 David Redondo 2022-08-10 14:44:06 UTC
Git commit 9a77503f0bd9ce0ccd0e99c08e9feef76c99743a by David Redondo.
Committed on 10/08/2022 at 14:18.
Pushed by davidre into branch 'master'.

lookandfeelmanager: Write colors before color scheme

While we indeed write both with KConfig::Notify flag interested
processes might only listen to the scheme change instead of
every color scheme group. When they react to the scheme change
the colors have not yet changed.
The colors kcm also does it in this order.
FIXED-IN:5.24.7

M  +2    -1    kcms/lookandfeel/lookandfeelmanager.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/9a77503f0bd9ce0ccd0e99c08e9feef76c99743a
Comment 32 David Redondo 2022-08-10 15:05:28 UTC
Git commit 864b2b7797ad8ad22a5eb3c90534b80ca1655d4c by David Redondo.
Committed on 10/08/2022 at 15:05.
Pushed by davidre into branch 'Plasma/5.25'.

lookandfeelmanager: Write colors before color scheme

While we indeed write both with KConfig::Notify flag interested
processes might only listen to the scheme change instead of
every color scheme group. When they react to the scheme change
the colors have not yet changed.
The colors kcm also does it in this order.
FIXED-IN:5.24.7


(cherry picked from commit 9a77503f0bd9ce0ccd0e99c08e9feef76c99743a)

M  +2    -1    kcms/lookandfeel/lookandfeelmanager.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/864b2b7797ad8ad22a5eb3c90534b80ca1655d4c
Comment 33 David Redondo 2022-08-10 15:07:40 UTC
Git commit 376c74f582a41a8e0eec7c4443d8b7401be97f0d by David Redondo.
Committed on 10/08/2022 at 15:07.
Pushed by davidre into branch 'Plasma/5.24'.

lookandfeelmanager: Write colors before color scheme

While we indeed write both with KConfig::Notify flag interested
processes might only listen to the scheme change instead of
every color scheme group. When they react to the scheme change
the colors have not yet changed.
The colors kcm also does it in this order.
FIXED-IN:5.24.7


(cherry picked from commit 9a77503f0bd9ce0ccd0e99c08e9feef76c99743a)

M  +2    -1    kcms/lookandfeel/lookandfeelmanager.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/376c74f582a41a8e0eec7c4443d8b7401be97f0d
Comment 34 Patrick Silva 2022-08-28 10:54:56 UTC
This bug is still reproducible with the steps provided in comment 0. Tested even with a new user account.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.25.80
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.5
Graphics Platform: Wayland
Comment 35 Nate Graham 2022-08-30 15:59:03 UTC
Can reproduce.
Comment 36 David Redondo 2022-08-31 07:35:54 UTC
Works for me with todays KDE neon unstable and gedit
Comment 37 SoilpH96 2022-09-07 07:55:19 UTC
Can still reproduce on Plasma 5.25.5. Tested on Firefox and Virt-Manager.
Comment 38 Nate Graham 2022-10-14 19:01:17 UTC
*** Bug 460359 has been marked as a duplicate of this bug. ***
Comment 39 Wachid Adi Nugroho 2022-10-21 23:31:13 UTC
Doesn't works on Wayland but it's works on X11

Plasma 5.26.0
Frameworks 5.99.0
Comment 40 Nate Graham 2022-10-24 18:01:50 UTC
Can confirm that.
Comment 41 Bug Janitor Service 2023-03-29 15:39:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kde-gtk-config/-/merge_requests/73
Comment 42 Fushan Wen 2023-03-30 00:19:53 UTC
Git commit 5f75f4c94d5fc07cc3dd9b36c78a297f3135feae by Fushan Wen.
Committed on 30/03/2023 at 00:17.
Pushed by fusionfuture into branch 'Plasma/5.27'.

kded: provide `org.gtk.Settings` when `GTK_USE_PORTAL` is not set on Wayland

A number of things that gnome-settings-daemon monitors for all the GTK+
applications aren't currently available for GTK+ Wayland clients, only
through XSettings.

As we already monitor fontconfig configurations, enabled GTK+ modules
and whether applications should use animations, export those through a
D-Bus interface.

See https://bugzilla.gnome.org/show_bug.cgi?id=786693

Based on patch by Martin Blanchard <tchaik@gmx.com>

https://bugzilla.gnome.org/show_bug.cgi?id=786694

Upstream change: https://github.com/GNOME/gnome-settings-daemon/commit/522640a6df95312669871e4f881afe4e37e495f9
FIXED-IN: 5.27.4

A  +9    -0    .reuse/dep5
M  +15   -2    kded/CMakeLists.txt
A  +76   -0    kded/gsd-xsettings-manager/gsd-xsettings-manager.cpp     [License: GPL(v2.0+)]
A  +32   -0    kded/gsd-xsettings-manager/gsd-xsettings-manager.h     [License: GPL(v2.0+)]
A  +7    -0    kded/gsd-xsettings-manager/org.gtk.Settings.xml
M  +11   -0    kded/gtkconfig.cpp
M  +4    -0    kded/gtkconfig.h

https://invent.kde.org/plasma/kde-gtk-config/commit/5f75f4c94d5fc07cc3dd9b36c78a297f3135feae
Comment 43 Fushan Wen 2023-03-30 00:25:48 UTC
Git commit 1608cf03670c71d85f110a7d2dda1c576e939032 by Fushan Wen.
Committed on 30/03/2023 at 00:21.
Pushed by fusionfuture into branch 'master'.

kded: provide `org.gtk.Settings` when `GTK_USE_PORTAL` is not set on Wayland

A number of things that gnome-settings-daemon monitors for all the GTK+
applications aren't currently available for GTK+ Wayland clients, only
through XSettings.

As we already monitor fontconfig configurations, enabled GTK+ modules
and whether applications should use animations, export those through a
D-Bus interface.

See https://bugzilla.gnome.org/show_bug.cgi?id=786693

Based on patch by Martin Blanchard <tchaik@gmx.com>

https://bugzilla.gnome.org/show_bug.cgi?id=786694

Upstream change: https://github.com/GNOME/gnome-settings-daemon/commit/522640a6df95312669871e4f881afe4e37e495f9
FIXED-IN: 5.27.4


(cherry picked from commit 5f75f4c94d5fc07cc3dd9b36c78a297f3135feae)

A  +9    -0    .reuse/dep5
M  +15   -2    kded/CMakeLists.txt
A  +76   -0    kded/gsd-xsettings-manager/gsd-xsettings-manager.cpp     [License: GPL(v2.0+)]
A  +32   -0    kded/gsd-xsettings-manager/gsd-xsettings-manager.h     [License: GPL(v2.0+)]
A  +7    -0    kded/gsd-xsettings-manager/org.gtk.Settings.xml
M  +11   -0    kded/gtkconfig.cpp
M  +4    -0    kded/gtkconfig.h

https://invent.kde.org/plasma/kde-gtk-config/commit/1608cf03670c71d85f110a7d2dda1c576e939032
Comment 44 Patrick Silva 2023-04-07 11:54:13 UTC
Cannot reproduce with some apps, but can with others.
Not affected apps:
Nautilus
Gnome Disks

Affected apps:
Gedit
Deluge torrent client
Brasero cd/dvd/bd burner
pamac package manager

streps to reproduce:
1. start Plasma session with Brezze global theme
2. change global theme to Breeze Dark
3. revert the global theme to Breeze
4. open any affected app mentioned above

Result: global theme is Breeze but the color scheme of the affected apps is Breeze Dark.
Logout and login fixes the affected apps.

Operating System: Arch Linux 
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Graphics Platform: Wayland
Comment 45 SoilpH96 2023-04-07 17:21:29 UTC
For me, the GTK color settings aren't applied the first time after I open a application if I use the plasma-apply-colorscheme command line tool (both when using it directly or invoking it from scripts). They will be applied at all subsequent times, and will be applied if the color scheme is changed from System Settings. 
Firefox also does not apply the color scheme correctly the first time even if using System Settings, appearing to use the Adwaita theme, but will apply it correctly at subsequent times. Chromium appears to require restarting to apply any color scheme correctly.

The end result is that currently theme switching automated via scripting remains mostly broken in GTK applications on Wayland.
Comment 46 Bug Janitor Service 2023-04-08 08:25:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kde-gtk-config/-/merge_requests/78
Comment 47 Fushan Wen 2023-04-10 00:51:16 UTC
Git commit 90b423429dde264117c729d5455e581ebb09a109 by Fushan Wen.
Committed on 08/04/2023 at 08:37.
Pushed by fusionfuture into branch 'Plasma/5.27'.

kded: add explicit waiting time before setting colors

modulesChanged signal will take some time to reach a GTK3 app, so wait a
moment before "colorreload-gtk-module" is finally loaded into GTK3 apps.
This makes sure color schemes in GTK3 apps are updated as expected.

This may not be a problem after https://gitlab.gnome.org/GNOME/gtk/-/commit/a40126e1f91a0cc8c45203d9ff229f65952eb541
is merged, but if the module list does not contain the expected module,
users will still notice color schemes are not changed in GTK3 apps for
the first time users change the system color scheme.

M  +16   -16   kded/config_editor/custom_css.cpp
M  +8    -0    kded/config_editor/custom_css.h
M  +7    -2    kded/gtkconfig.cpp

https://invent.kde.org/plasma/kde-gtk-config/commit/90b423429dde264117c729d5455e581ebb09a109
Comment 48 Bug Janitor Service 2023-04-10 00:52:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kde-gtk-config/-/merge_requests/79
Comment 49 Fushan Wen 2023-04-10 01:02:27 UTC
Git commit d49e02cf4bb1052e8b3c593c389d0a563abe00f8 by Fushan Wen.
Committed on 10/04/2023 at 00:51.
Pushed by fusionfuture into branch 'master'.

kded: add explicit waiting time before setting colors

modulesChanged signal will take some time to reach a GTK3 app, so wait a
moment before "colorreload-gtk-module" is finally loaded into GTK3 apps.
This makes sure color schemes in GTK3 apps are updated as expected.

This may not be a problem after https://gitlab.gnome.org/GNOME/gtk/-/commit/a40126e1f91a0cc8c45203d9ff229f65952eb541
is merged, but if the module list does not contain the expected module,
users will still notice color schemes are not changed in GTK3 apps for
the first time users change the system color scheme.


(cherry picked from commit 90b423429dde264117c729d5455e581ebb09a109)

M  +16   -16   kded/config_editor/custom_css.cpp
M  +8    -0    kded/config_editor/custom_css.h
M  +7    -2    kded/gtkconfig.cpp

https://invent.kde.org/plasma/kde-gtk-config/commit/d49e02cf4bb1052e8b3c593c389d0a563abe00f8
Comment 50 Fushan Wen 2023-04-10 01:12:15 UTC
Please note GTK4 apps are not possible to change their color schemes wihtout a restart, and if you set `GTK_USE_PORTAL=1`, you will still need to restart a GTK3 app to get the new color scheme. This is not a bug in Plasma but a limitation in GTK3/4. Make sure you have unset `GTK_USE_PORTAL` before reporting bugs.
Comment 51 postix 2023-04-10 19:37:02 UTC
(In reply to Fushan Wen from comment #50)
> Please note GTK4 apps are not possible to change their color schemes wihtout a restart

Is this an absolute statement or are there exceptions? For instance the color scheme of the GTK4 application `Dino 0.4.2` can be instantaneously changed by executing [1] under Plasma 5.27.4 Wayland
> gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'

[1] https://github.com/dino/dino/wiki/Frequently-asked-questions-(FAQ)#how-to-set-a-dark-theme
Comment 52 Fushan Wen 2023-04-11 07:59:04 UTC
(In reply to postix from comment #51)
> Is this an absolute statement or are there exceptions?


I believe there are no exceptions. You can try different accent colors to see if the color in Dino is updated.
Comment 53 postix 2023-04-11 10:47:45 UTC
(In reply to Fushan Wen from comment #52)
> I believe there are no exceptions. You can try different accent colors to
> see if the color in Dino is updated.

Never mind, looks like it's just about the dark/light theme variant, see [1][2], which can be changed instantaneously for GTK4 apps.

[1] https://wiki.archlinux.org/title/Dark_mode_switching#gsettings
[2] https://wiki.archlinux.org/title/Dark_mode_switching#KDE
Comment 54 Fushan Wen 2023-04-11 15:04:56 UTC
(In reply to postix from comment #53)
> (In reply to Fushan Wen from comment #52)
> > I believe there are no exceptions. You can try different accent colors to
> > see if the color in Dino is updated.
> 
> Never mind, looks like it's just about the dark/light theme variant, see
> [1][2], which can be changed instantaneously for GTK4 apps.
> 
> [1] https://wiki.archlinux.org/title/Dark_mode_switching#gsettings
> [2] https://wiki.archlinux.org/title/Dark_mode_switching#KDE

Dino is not a traditional GTK4 app. It uses libadwaita, which supports XDG color scheme.
Comment 55 Patrick Silva 2023-05-09 19:31:42 UTC
Unfortunately this bug is still reproducible with the steps from comment 44.

Operating System: Arch Linux 
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.9
Graphics Platform: Wayland
Comment 56 Fushan Wen 2023-05-10 01:02:50 UTC
Can anybody else reproduce? Also make sure you have not set `GTK_USE_PORTAL` otherwise the fix won't work.
Comment 57 Patrick Silva 2023-05-10 01:28:05 UTC
GTK_USE_PORTAL is not set on my system.

$ env|grep GTK
GTK_RC_FILES=/etc/gtk/gtkrc:/home/stalker/.gtkrc:/home/stalker/.config/gtkrc
GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/stalker/.gtkrc-2.0:/home/stalker/.config/gtkrc-2.0
GTK_OVERLAY_SCROLLING=0
Comment 58 Bug Janitor Service 2023-05-25 03:45:44 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 59 medin 2023-05-25 12:11:54 UTC
On 5.27.5, the situation is really messy and chaotic, if I change global theme from Breeze Light to Breeze Dark, only Firefox and Thunderbird change to a dark theme but not the Breeze one, both switch to Dark Adwaita (even if in Application Style > GTK settings I see Breeze applied), other GTK apps like UGet and Pamac don't update their theme and sometimes even after restarting them they remain using Light Breeze, the only solution I found in that special case is to change Color scheme to Breeze Light then switch to Breeze Black (sometimes needed to be done two times) which seems to fix Pamac and UGet and force them to use Breeze Dark theme.
Comment 60 Fushan Wen 2023-06-25 13:02:34 UTC
Patrick, have you installed xdg-desktop-portal-gnome ? One may need xdg-desktop-portal-gnome to make it work.
Comment 61 Fushan Wen 2023-06-25 13:03:20 UTC
(In reply to medin from comment #59)
> On 5.27.5, the situation is really messy and chaotic, if I change global
> theme from Breeze Light to Breeze Dark, only Firefox and Thunderbird change
> to a dark theme but not the Breeze one, both switch to Dark Adwaita (even if
> in Application Style > GTK settings I see Breeze applied), other GTK apps
> like UGet and Pamac don't update their theme and sometimes even after
> restarting them they remain using Light Breeze, the only solution I found in
> that special case is to change Color scheme to Breeze Light then switch to
> Breeze Black (sometimes needed to be done two times) which seems to fix
> Pamac and UGet and force them to use Breeze Dark theme.

This doesn't look like the same bug but corrupted config files.
Comment 62 medin 2023-06-25 13:18:10 UTC
(In reply to Fushan Wen from comment #61)

> This doesn't look like the same bug but corrupted config files.

No corruption can happen, because GTK2, GTK3 and GTK4 config files are fully updated via Plasma system settings after applying any global theme.
Comment 63 Patrick Silva 2023-06-25 14:17:59 UTC
(In reply to Fushan Wen from comment #60)
> Patrick, have you installed xdg-desktop-portal-gnome ? One may need
> xdg-desktop-portal-gnome to make it work.

yes, xdg-desktop-portal-gnome package is installed on my system.
Comment 64 Fushan Wen 2023-06-25 14:23:40 UTC
That looks unfortunate. I cannot even reproduce the bug with a new user, so something must be wrong elsewhere.
Comment 65 Roke Julian Lockhart Beedell 2023-06-25 23:41:55 UTC
(In reply to Fushan Wen from comment #61)
> (In reply to medin from comment #59)
> > On 5.27.5, the situation is really messy and chaotic, if I change global
> > theme from Breeze Light to Breeze Dark, only Firefox and Thunderbird change
> > to a dark theme but not the Breeze one, both switch to Dark Adwaita (even if
> > in Application Style > GTK settings I see Breeze applied), other GTK apps
> > like UGet and Pamac don't update their theme and sometimes even after
> > restarting them they remain using Light Breeze, the only solution I found in
> > that special case is to change Color scheme to Breeze Light then switch to
> > Breeze Black (sometimes needed to be done two times) which seems to fix
> > Pamac and UGet and force them to use Breeze Dark theme.
> 
> This doesn't look like the same bug but corrupted config files.

I get the same though. Firefox just switches to the dark version of the default GTK theme when I switch from Breeze Light to Breeze Dark.
Comment 66 medin 2023-06-26 09:44:08 UTC
(In reply to Fushan Wen from comment #61)

> This doesn't look like the same bug but corrupted config files.

Another scenario is happening here, after setting a new user, it seems to be working for first tries, except for Firefox and Thunderbird that reset their theme to Adwaita instead of using Breeze. But after the first crash of Plasma settings during changing global themes, then this fix stopped working and GTK3 apps refuse to follow global theme even if you restart them.
Comment 67 medin 2023-06-26 09:55:07 UTC
(In reply to Fushan Wen from comment #56)
> Can anybody else reproduce? Also make sure you have not set `GTK_USE_PORTAL`
> otherwise the fix won't work.

Truthfully, unsetting GTK_USE_PORTAL to have this fix (even if it doesn't work for now) have much more severe problems than forcing color scheme and simply restarting the app. Because all GTK apps will start using that ugly GTK file picker instead of KDE dialogs.
Comment 68 Fushan Wen 2023-06-26 11:41:31 UTC
(In reply to medin from comment #67)
> (In reply to Fushan Wen from comment #56)
> > Can anybody else reproduce? Also make sure you have not set `GTK_USE_PORTAL`
> > otherwise the fix won't work.
> 
> Truthfully, unsetting GTK_USE_PORTAL to have this fix (even if it doesn't
> work for now) have much more severe problems than forcing color scheme and
> simply restarting the app. Because all GTK apps will start using that ugly
> GTK file picker instead of KDE dialogs.

Contrary to intuition, setting GTK_USE_PORTAL=1 in a non-portal environment will cause many unintentional bugs in GTK apps. GTK has added some workarounds to avoid them.
Comment 69 Fushan Wen 2023-06-26 11:47:12 UTC
(In reply to third="Beedell", first="Roke", second="Julian Lockhart" from comment #65)
> (In reply to Fushan Wen from comment #61)
> > (In reply to medin from comment #59)
> > > On 5.27.5, the situation is really messy and chaotic, if I change global
> > > theme from Breeze Light to Breeze Dark, only Firefox and Thunderbird change
> > > to a dark theme but not the Breeze one, both switch to Dark Adwaita (even if
> > > in Application Style > GTK settings I see Breeze applied), other GTK apps
> > > like UGet and Pamac don't update their theme and sometimes even after
> > > restarting them they remain using Light Breeze, the only solution I found in
> > > that special case is to change Color scheme to Breeze Light then switch to
> > > Breeze Black (sometimes needed to be done two times) which seems to fix
> > > Pamac and UGet and force them to use Breeze Dark theme.
> > 
> > This doesn't look like the same bug but corrupted config files.
> 
> I get the same though. Firefox just switches to the dark version of the
> default GTK theme when I switch from Breeze Light to Breeze Dark.

That is a different bug. Please either open a new bug or report it to Firefox.
Comment 70 Fushan Wen 2023-06-26 14:22:16 UTC
I just downloaded the latest Fedora KDE (0615) and KDE Neon (0622), tried to reproduce the bug in the two Live environments, but still cannot reproduce it. I consider this bug as fixed, and now it's a packaging issue that causes the bug. Please report the issue to your distro. Thanks!
Comment 71 medin 2023-06-26 16:09:22 UTC
For anyone suffering from this problem on Arch based distros, simply go to Plasma settings then select "Startup and Shutdown" then "Background Services", locate "GNOME/GTK Settings Synchronization Service" and stop it then restart it to get the applied global theme to propagate to all running GTK+ apps without needing to restart them.
Comment 72 Patrick Silva 2023-06-27 15:58:39 UTC
Well, I have just downloaded neon-user-20230622-0716.iso, created a bootable flash drive with it, and I can reproduce the bug with gedit and brasero following the steps from comment 44.
Comment 73 Patrick Silva 2023-06-27 16:24:14 UTC
I have just noticed something very important on both Arch and neon: the bug occurs after changing the global theme via Global Theme KCM, but it does not when doing it via Quick Settings page.

streps to reproduce:
1. start Plasma session with Breeze global theme
2. open System Settings > Appearance > Global Theme KCM
3. change global theme to Breeze Dark
4. revert the global theme to Breeze
5. open gedit or brasero

Result: the app used in the last step uses dark color scheme instead of breeze color scheme.

Can you reproduce Fushan?
Comment 74 Fushan Wen 2023-06-28 01:11:56 UTC
Can reproduce. Let's move the bug to Global Theme.
Comment 75 medin 2023-07-05 13:43:12 UTC
(In reply to Fushan Wen from comment #68)

> Contrary to intuition, setting GTK_USE_PORTAL=1 in a non-portal environment
> will cause many unintentional bugs in GTK apps. GTK has added some
> workarounds to avoid them.

Well, changing the global theme is done once in months so rebooting to fix it seems fine for me, while removing GTK_USE_PORTAL=1 will force all GTK apps to use their GTK file/folder selector which will break the uniform look of file selectors in Plasma desktop, and most importantly is that file/folder selector is used many times per day compared to the frequency of changing the global theme.
Comment 76 Bug Janitor Service 2023-12-13 17:05:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kde-gtk-config/-/merge_requests/100
Comment 77 Nate Graham 2024-03-04 19:26:55 UTC
Promoting this to be a 15-minute bug since it's Wayland-only and the Wayland-session is the default in Plasma 6 now.
Comment 78 Michał Dybczak 2024-03-23 16:49:31 UTC
I noticed this bug just now in Plasma 6.0.2, because I wasn't using global themes much before. Basically, after updating to Plasma 6, I switched to Breeze Dark. I was changing a lot of things after the update, so I didn't notice that gtk3 theme was not following, I was applying it manually later anyway. Now, I switched to light theme using Breeze global theme.

At first, I thought that LibreOffice (flatpack VCL gtk3) was bugged, because it wasn't following the system theme, so I attempted to debugging it, but some time later I noticed that Thunderbird, electron and other apps also were still dark themed. It turned out that GTK theme wasn't applied on Global Theme Breeze usage.

Of course, I'm using Wayland (and was using it since over half a year). The bug is still there and can be confusing.
Comment 79 medin 2024-03-29 10:21:21 UTC
With a new user on Plasma6.0.2, this problem became persistent, even if I restart that GNOME sync theme service, it doesn't work.

Plus, Plasma style and icons in open/save dialogs sometimes keep using the ones from previously selected global theme, this was not present in Plasma 5.27.10.
Comment 80 Fushan Wen 2024-06-06 16:32:59 UTC
If you are using GTK_USE_PORTAL=1, it's expected the color is not synced on Wayland.
Comment 81 Roke Julian Lockhart Beedell 2024-06-06 16:51:31 UTC
(In reply to Fushan Wen from comment #80)
Why?
Comment 82 medin 2024-06-06 21:53:23 UTC
(In reply to Fushan Wen from comment #80)
> If you are using GTK_USE_PORTAL=1, it's expected the color is not synced on
> Wayland.

Why was this bug closed ?

Even without GTK_USE_PORTAL=1, automatic application of GTK theme is not working with Plasma 6.0.5.
Comment 83 Fushan Wen 2024-06-07 00:17:49 UTC
Because the bug has been fixed for a long time, other people can't reproduce it, and what you experience is likely caused by a misconfiguration of your distro. Please upload a video of the bug.
Comment 84 medin 2024-06-07 01:04:17 UTC
Created attachment 170216 [details]
Firefox and Thunderbird not applying gtk theme
Comment 85 medin 2024-06-07 01:05:07 UTC
(In reply to Fushan Wen from comment #83)
> Because the bug has been fixed for a long time, other people can't reproduce
> it, and what you experience is likely caused by a misconfiguration of your
> distro. Please upload a video of the bug.

I attached a video showing the problem with Firefox and thunderbird.
Comment 86 Fushan Wen 2024-06-07 01:13:04 UTC
So that is a completely different bug, please open a new bug. Thanks!
Comment 87 medin 2024-06-07 01:30:49 UTC
Created attachment 170217 [details]
Changing global theme

Sorry, I made an error and showed the wrong scenario :)
Comment 88 Fushan Wen 2024-06-07 01:40:00 UTC
Can reproduce. I think it should be removed from the HI list as it only affects the lnf KCM. Setting colors in the color KCM is not affected.
Comment 89 Nate Graham 2024-06-07 23:57:45 UTC
Lowering priority since this only affects the Global Themes KCM, and the number of GTK apps that even respond to our re-coloring in the first place is diminishing. :(
Comment 90 Bug Janitor Service 2024-08-24 10:54:11 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kde-gtk-config/-/merge_requests/116
Comment 91 Michael Weghorn 2024-08-27 14:38:10 UTC
Git commit ffe400047ae4cd9836aff7f9a1795115edb738d0 by Michael Weghorn.
Committed on 24/08/2024 at 10:50.
Pushed by ngraham into branch 'master'.

kded: Handle global theme change

A "Global Theme" can include almost all
of the visual appearance settings, so call
`GtkConfig::applyAllSettings` to make sure all of them
are in sync after being notified about a change
of the global theme.

M  +4    -0    kded/gtkconfig.cpp

https://invent.kde.org/plasma/kde-gtk-config/-/commit/ffe400047ae4cd9836aff7f9a1795115edb738d0
Comment 92 Nate Graham 2024-08-27 14:40:44 UTC
Git commit 8d929fc86396ce28c8f89b35ef1eeeed9ef3591d by Nate Graham.
Committed on 27/08/2024 at 14:38.
Pushed by ngraham into branch 'Plasma/6.1'.

kded: Handle global theme change

A "Global Theme" can include almost all
of the visual appearance settings, so call
`GtkConfig::applyAllSettings` to make sure all of them
are in sync after being notified about a change
of the global theme.


(cherry picked from commit ffe400047ae4cd9836aff7f9a1795115edb738d0)

Co-authored-by: Michael Weghorn <m.weghorn@posteo.de>

M  +4    -0    kded/gtkconfig.cpp

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