Bug 384950 - Ensure that the Colors: sections of kdeglobals are never empty, or sync it on boot anytime it differs from the installed color scheme's values
Summary: Ensure that the Colors: sections of kdeglobals are never empty, or sync it on...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.10.5
Platform: ROSA RPMs Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-22 03:58 UTC by Pulfer
Modified: 2021-11-03 19:46 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pulfer 2017-09-22 03:58:33 UTC
Breeze decorator uses wrong colors. It happens when there are no colors explicitly given in [WM] section of kdeglobals. It should load [WM] section from the color scheme but it doesn't.

How to reproduce:
1. Set Breeze look-and-feel
2. Edit ~/.config/kdeglobals
3. Go to [WM] section and comment "activeBackground=71,80,87" line there
4. Save file
5. Active decoration color turns from grey to blue

Expected result:
Active decoration color should stay grey as given in Breeze.colors:

[WM]
activeBackground=71,80,87
Comment 1 Pulfer 2017-09-22 04:02:17 UTC
The bug was found with:

ROSA Desktop Fresh R9 (2016.1)
Qt 5.9.1
KF 5.38.0
Plasma 5.10.5

There's a chance that it's KF5 bug and Breeze only triggers it.
Comment 2 Hugo Pereira Da Costa 2017-09-22 05:27:34 UTC
Hi,
Thanks for reporting 
However this how it works:
When you select a color theme, its colors gets copied into kdeglobals. 
The decoration then follows that. 
If you alter kdeglobals, you then alter the colors seen by the decoration.
So what you report is the normal behavior. 
Closing as invalid.
Comment 3 Pulfer 2017-09-22 05:54:50 UTC
(In reply to Hugo Pereira Da Costa from comment #2)
> Hi,
> Thanks for reporting 
> However this how it works:
> When you select a color theme, its colors gets copied into kdeglobals. 
> The decoration then follows that. 
> If you alter kdeglobals, you then alter the colors seen by the decoration.
> So what you report is the normal behavior. 
> Closing as invalid.

It's not really invalid because it seems to happen when there are no colors defined (copied) in kdeglobals.

See how it's done in plasma-integration: https://cgit.kde.org/plasma-integration.git/tree/src/platformtheme/khintssettings.cpp#n368

---
if (mKdeGlobals->hasGroup("Colors:View")) {
    m_palettes[QPlatformTheme::SystemPalette] = new QPalette(KColorScheme::createApplicationPalette(mKdeGlobals));
} else {
[load color scheme]
---

But Breeze decorator seems to ignore color scheme. Maybe it's because there are no [WM] color options in KColorScheme: https://cgit.kde.org/kconfigwidgets.git/tree/src/kcolorscheme.cpp

So KColorScheme::createApplicationPalette loads incomplete palette.
Comment 4 Pulfer 2017-09-22 07:00:14 UTC
In fact, I don't know KDE internals well enough, so I can only grep sources and guess. Maybe [WM] colors are not designed to be set from KColorScheme. But somehow they should be loaded from color scheme (as they are defined there) if not defined in kdeglobals.

One more piece of code that loads [WM] only from kdeglobals and not from color scheme:
https://cgit.kde.org/plasma-desktop.git/tree/kcms/krdb/krdb.cpp#n137
Comment 5 Hugo Pereira Da Costa 2017-09-22 08:08:53 UTC
Hi, 

you are right that my closing the bug was a bit hasty. Sorry about that, reopening.

I'll investigate a bit. But this is not breeze specific. 
Colors are dealt with by upstream libkdecoration.
Most likely it indeed does not look for the relevant default when the entry is missing from kdeglobals, and does not use kcolorshceme.
Comment 6 Hugo Pereira Da Costa 2017-09-22 08:20:04 UTC
So, investigating: 
Colors are set in kwin/decorations/decoration
There, kconfiggroup is used, getting the WM colors from kdeglobals and if not found they are replaced by some entries in QPalette. 

Now QPalette itself has no role for window decoration, so the default are approximate. and in any case the color scheme "file" is ignored. 
But again, this is on purpose: setting the color scheme is simply (and nothing more than), copying the content of this file in kde globals. once this operation is done, no-one else knows about the original file, nor can access it. 

In any case, this is an issue to be dealt with at the kwin level, not breeze, sorry.
Comment 7 Pulfer 2017-09-22 10:11:37 UTC
Surely, not a Breeze bug. 

And it looks like only [WM] from ~/.config/kdeglobals is loaded. Even [WM] colors from /etc/xdg/kdeglobals are ignored, not only from color scheme.
Comment 8 Martin Flöser 2017-09-22 13:16:50 UTC
(In reply to Pulfer from comment #7)
> And it looks like only [WM] from ~/.config/kdeglobals is loaded. Even [WM]
> colors from /etc/xdg/kdeglobals are ignored, not only from color scheme.

Given the code this is intended. It explicitly does not ask for cascading config.

KWin itself does not have any idea about which color scheme is used and KWin certainly does not care about it. This does not belong into KWin.

This is something startkde or kcminit needs to take care of to make sure the color scheme is synced to kdeglobals.

Actually this bug should be reassigned to a component "plasma-workspace" or "startkde" but those do not exist, so reassigning to plasmashell as it's the most closest thing to the overall desktop.
Comment 9 Pulfer 2017-09-22 13:30:40 UTC
(In reply to Martin Flöser from comment #8)
> (In reply to Pulfer from comment #7)
> > And it looks like only [WM] from ~/.config/kdeglobals is loaded. Even [WM]
> > colors from /etc/xdg/kdeglobals are ignored, not only from color scheme.
> 
> Given the code this is intended. It explicitly does not ask for cascading
> config.

Maybe there should be an exception for kdeglobals (as there are other hacks for kdeglobals in the code)?

-    auto config = KSharedConfig::openConfig(m_colorScheme, KConfig::SimpleConfig);
+    KConfig::OpenFlags openMode = KConfig::SimpleConfig;
+    if (m_colorScheme.endsWith(QStringLiteral("/kdeglobals")))
+        openMode = KConfig::FullConfig;
+
+    auto config = KSharedConfig::openConfig(m_colorScheme, openMode);
Comment 10 Martin Flöser 2017-09-22 13:49:20 UTC
(In reply to Pulfer from comment #9)
> (In reply to Martin Flöser from comment #8)
> > (In reply to Pulfer from comment #7)
> > > And it looks like only [WM] from ~/.config/kdeglobals is loaded. Even [WM]
> > > colors from /etc/xdg/kdeglobals are ignored, not only from color scheme.
> > 
> > Given the code this is intended. It explicitly does not ask for cascading
> > config.
> 
> Maybe there should be an exception for kdeglobals (as there are other hacks
> for kdeglobals in the code)?

As I wrote: this is intended here, so no: this should not use a special case for kdeglobals.

Otherwise let's please keep this bug focused on the default config not having the WM group
Comment 11 Pulfer 2017-09-22 15:28:13 UTC
Still it's quite surprising and unexpected behavior (of overall desktop) that most colors can be properly loaded from color scheme (with "~/.config/kdeglobals -> /etc/xdg/kdeglobals -> color scheme" priority order). While [WM] colors can be loaded only from ~/.config/kdeglobals.
Comment 12 Christoph Feck 2017-10-12 20:29:52 UTC
KWin decoration colors are indeed unrelated to KColorScheme colors. The systemsettings color editor copies the colors of the selected scheme into the appropiate sections of 'kdeglobals'.

If the [WM] section (with decoration colors) is not present in the 'kdeglobals' file, KConfig falls back to try the application configuration file, in this case 'kwinrc'.

I do not see how it is a bug.
Comment 13 Pulfer 2018-02-03 06:20:19 UTC
(In reply to Martin Flöser from comment #8)
> This is something startkde or kcminit needs to take care of to make sure the
> color scheme is synced to kdeglobals.

Can someone with good knowledge of Plasma internals implement this feature?
Comment 14 Nate Graham 2021-08-31 19:08:15 UTC
This would seem to be the cause of a downstream issue in Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1963709
Comment 15 Nate Graham 2021-09-17 19:59:23 UTC
See also https://phabricator.kde.org/T13663
Comment 16 Nate Graham 2021-11-03 19:46:36 UTC
This was just fixed by Marco Martin in https://invent.kde.org/plasma/plasma-workspace/-/commit/590e0c0708febb9de4f88f4127e0f26fba6a9f70!