startkde: Close systemd session when startplasma exits
Startplasma is the session leader managed by the display manager. Anything started by systemd
On logout or shutdown we correctly stop the graphical-session target and then startplasma quits.
If SDDM is restarted or startplasma explodes the order happens in reverse. startpasma quits, but we also need our units to close. Otherwise we end up in a situation where we're at the login manager but with all our background services continuing to run.
Worse this prevents logging in again.
Given startplasma starts the plasma-workspace target it's on to make sure this target gets stopped. This starts a small service that exits if startplasma quits, the plasma-workspace serivce is bound to this and will teardown if this exits.
This seems a convoluted approach, but it's based on the approach that Gnome uses called gnome-session-monitor.
if testing note that there's an unrelated bug in ksplash-ready which makes that hang for 60s. If you restart sddm within the first 60s you hit that bug. Easy to workaround, but that whole service is a bit of a hack so worth finding a better solution.