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 wouldn't have worked properly.
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.
Actions
[ ] 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
[ ] Figure out when startplasma has to quit. Currently it waits for plasma-session.
[ ] All units need to not have SESSION_MANAGER env during the QApp constructor but do need it for anything they spawn (or my new qcoreapplication sessionmanager enabled which is in Qt5.14)
plasma-session is written so that startup.cpp could be a single shot that quits when launching finishes, and shutdown.cpp could be simple DBus activated helper...
the only reason it stays alive is so that plasmasession knows when to quit...
If startplasma had a way to tell it to die then shutdown.cpp could be ported to that?
Maybe needs some brainstorming
[ ] to terminate the units gracefully. Maybe eliasp did
[ ] Add units for kcminit phase 1 & 2 properly
[ ] Handle old-school autostart
[ ] 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)