initialize the kcolorscheme at the first app start
Needs ReviewPublic

Authored by mart on Apr 2 2019, 2:58 PM.

Details

Reviewers
None
Group Reviewers
Plasma
Summary

when an app starts when there isn't a kdeglobals yet, it reads from
the color theme defined in the look&feel package, but it did build only the
QPalette of the application. any application using KColorScheme directly failed to
get the proper color at startup (e.g. plasmashell, but also any app needing a color present in kcolorscheme but not in qpaletter, like activetext, negativetext etc)

at the first start, copy over the colors from the scheme file to kdeglobals (same code of the kcm)
that code is not cheap, but should be executed exactly once at the startup of the first app on an empty session

Test Plan

started plasma with breezedark as lnf as the only key in /etc/xdg/kdeglobals, plasmashell gets the proper breeze dark colors now

Diff Detail

Repository
R135 Integration for Qt applications in Plasma
Branch
phab/initializeColors
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 10371
Build 10389: arc lint + arc unit
mart created this revision.Apr 2 2019, 2:58 PM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 2 2019, 2:58 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart requested review of this revision.Apr 2 2019, 2:58 PM
mart updated this revision to Diff 55286.Apr 2 2019, 3:01 PM
  • revert mistake

The analysis makes sense, I don't understand why this is the correct fix.

Colours aren't the only thing lookandfeel syncs to kdeglobals when set.
Is it correct that all of them have a fallback to loading a second config? If they do, why does the lnf kcm copy into kdeglobals instead of just deleting the kdeglobals entries?

hein added a subscriber: hein.Apr 2 2019, 7:50 PM

Or the QPA could look at the LnF in the first place instead of kdeglobals?

mart added a comment.Apr 3 2019, 8:20 AM

The analysis makes sense, I don't understand why this is the correct fix.

Colours aren't the only thing lookandfeel syncs to kdeglobals when set.
Is it correct that all of them have a fallback to loading a second config? If they do, why does the lnf kcm copy into kdeglobals instead of just deleting the kdeglobals entries?

as far i know, kcolorscheme only looks for colors in kdeglobals (more precisely, reads from KSharedConfig::openConfig(), which is from applicationnamerc and then falls back to kdeglobals)

an alternative approach could also be making kcolorscheme directly read from lnf, tough, may add complexity is a more often used code path?

the fallback is:

  • colors in applicationnamerc
  • colors in kdeglobals
  • colors from the colorscheme file set as ColorScheme again in kdeglobals
  • look in the lnf package set in kdeglobals, then look if it contains a "colors" file
  • look in the lnf package set in kdeglobals, then look at the "defaults" file in the lnf, and look at the color scheme name

Is probably better to do this dance only once at startup?