A long time very display manager had its own way of determining the various sessions. Eventually this was standardized via freedesktop.org using /usr/share/xsessions. Display managers can figure out the various sessions using .desktop files in previous mentioned directory.
With Wayland coming along, you want to perhaps know which of those sessions should run under Wayland, which under X. A specific header was added to the gnome-wayland session file, X-GDM-NeedsVT=true.
Adding a new header is problematic. Adding this means breaking compatibility. But maybe we’ll just ignore any compatibility problems. Before worrying about this, I noticed that in Mageia /usr/share/xsessions is auto-generated. Any file you place there will be overwritten on reboot! Meaning, no such header will appear in Mageia. No GNOME Wayland.
I asked around why these things are still being overwritten. Apparently in the past we used to have some other method which on Mageia is converted into /usr/share/xsessions. Anyway, clearly legacy and time to get rid of this. I quickly looked into what Debian does. They go from xsessions to the old way of doing things, still. Debian being Debian.
Imagine my surprise in discovering that we cannot just kill this code. XDM (fallback display manager on Mageia) only supports that old way! So even though it has been 10+ years (in my mind at least), we continue to live on with two ways of doing this. Plus in bits that we cannot just ignore.
Showing sessions seems rather basic functionality, solved ages ago. Anyone would expect display sessions to show up in every display manager you might install. Reality is a mess. There is choice in display managers, but there is a lot of complexity in supporting this. The way of doing that is different per distribution. Although we have Linux Plumbers conferences and freedesktop.org (which is not specific to Linux), this never was simplified.
Why to simplify code? For that I rather point to something known to developers, meaning code refactoring. In general, simplifying is usually done to ease either maintenance and/or make it extensible. A clear example is above, there are outright bugs in various distributions triggered by this. The maintenance of this is higher than it should be. And this for something really basic, ensuring that the sessions are the same no matter which display manager you use.
Another way of thinking: The CEO of a very large non-technical company sometimes talks about technical legacy and the need to simplify. Isn’t it time to acknowledge this in free software? Pretty safe to assume that the free software community is way more technical than this CEO or an average person in that company.
Another layer of abstraction
Now in my previous blogpost I talked about logind and systemd. An argument raised there is that “power management” is something anyone should be able to expect in 2013. This seems overly similar to the expectation that every session shows up in any display manager.
To solve this, let’s not continue in having abstraction layers around for another 10+ years for something as basic as power management. The different solutions should define one API and stick with it, whatever that is. Let’s not push such complexity into desktop environments. That would lead to similar differences as the session support in Debian vs Mageia. Want to offer choice in power management or another display manager? Go for it! Using one API (/usr/share/xsessions rings a bell :P). Not loads. Not anything which requires an abstraction layer. How to get there? Who cares! Talk about it on Linux Plumbers conferences, freedesktop.org, by email, by implementing the same API as systemd or whatever you think is best. But let’s not pretend to go for choice while going for complexity.
It’s 2013, let’s fix things in the right place!
Wayland vs /usr/share/xsessions?
For those who are wondering about the original topic of this blogpost, this is how things were solved: Wayland specific sessions are placed in /usr/share/wayland-sessions. This avoids breaking compatibility in non-GDM display managers and avoids breakage in Mageia. The right thing to do because breaking display managers is bad. That said, having and expecting all display managers to support /usr/share/xsessions properly is long overdue.