Work a while ago was started here: https://github.com/KDE/plasma-systemd-integration
It stalled somewhat. Partly due to some systemd things, partly due to the fact that some minor details which were missed due to the previous state of plasma startup.
I think our best bet is to work on this upstream rather than separately.
Aleix and I have been working on startup trying to make it possible, now startup is properly documented and the memory is fresh it's a good time to do this properly.
Gnome have since completed their port: https://blogs.gnome.org/benzea/2019/10/01/gnome-3-34-is-now-managed-using-systemd/
Behaviour has to be opt-in.
Possibly completely hidden till after the next LTS?
Though use of units is something Munich people have requested, so maybe LTS is good. Dunno.
TODO
[ ] Port all instances of startup.updateLaunchEnv && klauncher.setLaunchEnv
to include programatic equivalent of "dbus-update-activation-environment --systemd"
maybe it's worth a helper function to wrap all update calls into 1.
[/] Change startplasma to instead of calling plasma-session executable to request plasma-target
Things to decide / ramblings:
[ ] Figure out when startplasma has to quit. Currently it waits for plasma-session.
Solution in plasma-systemd-integration is not workable (it's a while loop and a sleep)
[ ] Ideally all units need to not have SESSION_MANAGER env during the QApp constructor, otherwise they'll be torn down by ksmserver. But they do need it set for anything they spawn.
[ ] We need to figure out how to terminate the units gracefully.
Eliasp bound them to the lifecycle of ksmserver...clever but I want to make ksmserver more optional
Gnome's situation is super complicated: https://guadec.ubicast.tv/videos/managing-gnome-sessions-with-systemd_85843/ 30 minutes in
[ ] We need to figure out how to call kcminit phases 1 and 2 separately
[ ] What do we do with old-style autostart .desktop files
Use generators? Currently gnome uses an executable
[ ] Handle ksmserver session restore properly. I changed it so it had a DBus call to trigger restore, so we can have a unit with type=singleshot exec=dbus-send org.kde.ksmserver /KSsmserver restoreSession (I hope)
[ ] make kglobalaccel use dbus activation if relevant. That way systemd hooks can kick in if relevant and spawn as a service correctly.
Could mean we teach KService about DBus activation, it is part of the FD.O spec of .desktop files, or we do something custom in kglobalaccel, that might be better for actions anyway.
----
Syncing with gnome:
Propose a standard .target symlink that other services can rely on (i.e a desktop.target that is wanted by plasma.target and gnome.target)
Propose a standardised hint in autostart .desktop files for "ignore me when using systemd mode"