Handling initial screen configuration and kwin
Current state
Kwin_wayland loads, and applies a very basic configuration.
KScreen starts to load
Plasma loads
Then kscreen changes all the screens. If Plasma loads quickly it loads at the wrong scale/size/screen count and ends up in a mess. Ideally plasma should handle this, but even then we're making Plasma do more work.
kscreen's setup is very async.
- getInitialConfig is queued
- the fetching of this is then async
- then it applies what it deems to be the "correct" state, this is also aync
Our bootup does ensure that plasmashell comes after kscreen is started, but not after kscreen has finished starting (if that difference makes sense)
Kwin does have a user-defined static map it can use for initial screen loading with a basic config. The file format is not helpful to distributors (plasma-mobile vendors) as UUIDs are not consistent.
Option 1
Block in kded when we do our initial load until the kscreen state is applied. Our bootup sequence will make sure kded's first phase is up before plasmashell starts
It doesn't matter if kwin at the start if it has the wrong screen information if it's just showing ksplash fullscreen anyway.
Option 2
Block in plasma to kscreen with some bespoke kscreen<--> plasma iface. We sort of did this in very early Plasma 5.0, where we fetched kscreen's config which means we block on kscreen having at least started up.
Option 3
Move initial config loading from kscreen to kwin_wayland, this could be as little as adding a way to parse the kscreen config file into kwin. When kscreen does finally load it sees that the applied config matches what it would apply in this situation and no-ops
This won't help the first-run case.
Option 4
Move half all of the daemon aspects of kscreen into kwin.
Fixes the initial config problem, but now kwin is turned into even more of a monolith. It makes kscreen more complex too.