In some of the comments about the latest Plasma release sometimes someone brings up the topic of systemd. This is normally met with the rebuttal "Why should a desktop environment care about what init sytstem is used?".
It's a very sensible question, but it's also one that's easily answered. I wanted to explain how different parts of systemd relate to Plasma.
We don't care. It doesn't affect us.
The init system is one part of systemd that doesn't affect us at all, and any other could be used.
Logind is a tiny daemon that keeps track of seats and sessions on your machine.
In principle it's very simple, every login (including autologin) goes via PAM (Pluggable Authentication Modules) modules; a special PAM module signals to a central daemon that a new session is started and tell it when it stops.
This blog series has the most detail on session tracking and why logind solves problems better.
We need knowledge of all active sessions from within Plasma to be able to offer session switching inside the UI and to warn the user if they attempt to shutdown whilst other sessions are still active.
This class kdisplaymanager in plasma-workspace shows our abstraction layer growing since 2004; it currently has Logind support but as we have been adding to a constantly broken abstraction layer it's used very badly. It has tracking code for over 5 different systems (KDM, old GDM, new GDM (which is now old), consolekit, org.freedesktop.DisplayManager, and now logind) and is probably one of the ugliest pieces of code in Plasma.
Logind does seem to solve these problems better, particularly with regards to multi-seat and the other features it provides.
We need to tidy this area, having an abstraction layer only leaves us with a lowest common denominator, and it isn't pretty.
When people reference standards, someone will cite XKCD, I think more of it like this:
Logind allows the session leader to open input devices which are otherwise only available to root.
This allows kwin to monitor key and mouse events whilst blocking other applications from sniffing your keystrokes.
One other feature logind provides that we are making use of is inhibition locks.
Upower will notify us when the system is about to be suspended. Which sounds ideal, we should be able to react to that and perform pre-suspend tasks. Unfortunately it's not very useful as the system is shutdown before it finishes.
When logind is asked to suspend, it will inform all applications which have requested a delay. It will then wait for up to 30s for all apps to respond that they have finished their pre suspend tasks.
This allows us to make sure the lock screen is completely up and running before we suspend the system; so you don't have that jarring and insecure moment where you open your laptop and it is still showing the original contents before the lock screen finally loads.
We even use this feature from Telepathy, the instant messaging system. In order to save bandwidth most IM protocols aren't constantly sending data The problem is when we disconnect it will take a long time for the server to notice and update your status. We have an inhibition delay that gives us a very small window to shout to all the servers "we're going offline now".
Systemd also comes with a set of utilities for performing some system administration utilities, such as changing the hostname, timezone, locale and such.
What makes these interesting is that the components are split into two parts; a small command line client but more importantly a defined DBus interface to a small DBus activated daemon that uses polkit for authorisation and does the actual changes.
This approach is similar to what we do in our date and time config module; we have our GUI and we also have a small helper app that's DBus activated and runs as root which we are shipping ourselves. Our helper app then runs one of 6 different ntp programs; almost all of which are now outdated.
We don't want to be writing code that runs as root and as a user you really don't want us to be doing so.
By using a defined DBus interface we are able to share this code between desktops and share safe audited code for all root access.
Naturally this not only applies for timedated, but also hostnamed, machined and whatever else might come in the future.
In addition timedated, the systemd interface for changing the time, emits signals whenever it changes the timezone.
Currently in order to achieve the same effect we have a constantly running daemon that monitors /etc/localtime for file changes and then emits DBus signals for all the other apps.
If we could rely on everyone setting the timezone through timedated we can remove this watch which will free some resources for everyone.
There are a few other places where embracing systemd adds functionality or makes code simpler; our system guard can show which seat and which container an application is running on. I already wrote a patch for this, but got bored #ifdef-ing everything.
Using a common storage for log files means ksystemlog could be restored to a working product again.
Last but not least we have user units.
Currently init is handled by a rather cumbersome shell script. It's as simple as starting the KDE services in order in a list.
User Units allow Plasma services to use the same features as available to system daemons.
Most obviously we get the faster bootup as we are able to parallelise component startup, but there are more benefits.
Systemd provides services to restart crashing applications with finer control, a watchdog can detect a hung application or if a process gets out of control using too much resources and restart it automatically. Logging will also be greatly improved; faster to run and easier to supply developers with relevant information instead of a giant .xsession-errors file.
A trial has been started here providing user units; which when ready will work their way into the main plasma-workspace.
Longer term, we can investigate replacing parts of kded, the KDE daemon with systemd directly, providing a single common way to manage all services.
Hopefully it clears up what we mean when we talk about systemd and desktop environments, and where we could use different parts of systemd.
It should be apparent that as developers there are parts we want to embrace as it. In many cases it allows us to throw away large amounts of code whilst at the same time providing a better user experience. Adding it as an optional extra defeats the main benefit.
As maintainers we have a duty to balance what will provide the best experience for the majority of our Plasma users without leaving anyone with a broken system. Projects like this bring the interfaces we need to BSD and as it gets more stable we should be able to start distributing features.