The upcoming version of MDM, which will be featured as an upgrade in Betsy and as default in Linux Mint 17.2, received important changes today.
At first sight, you probably won’t notice much difference, that “lambda” sign in your login screen might switch to a little “Ci” or “M”, indicating that MDM corrected your session selection. Under the hood though, the way things work in regards to sessions was completely redesigned.
Warning: This post is quite technical :)
The way it worked
Prior to version 2.0, if MDM didn’t find a valid session in your ~/.dmrc it would run a generic built-in default session which ended up running whatever /etc/alternatives/x-session-manager pointed to. That worked just fine but it meant that, in the absence of a .dmrc file, MDM didn’t actually really know what you were running… and that’s an issue because even though it didn’t really need to know, it meant that your session was a tiny bit different depending on whether you selected a session or ran the default one.
For instance, if you didn’t select any session in MDM, you would see the following:
- “ps –ef –forest” would report x-session-manager as being your session manager
- “env” would report DESKTOP_SESSION as being equal to “default”
If you selected the Cinnamon session in MDM, you would see the following:
- “ps -ef –forest” would report cinnamon-session as being your session manager
- “env” would report DESKTOP_SESSION as being equal to “cinnamon”
In both cases, you’re running the exact same session… it looks the same, it’s Cinnamon, the same settings are applied etc etc.. but there are tiny differences which are important. Although x-session-manager basically runs cinnamon-session, we lose information here. If a script or a program wanted to detect if Cinnamon was running.. and if that script relied on the DESKTOP_SESSION variable or the cinnamon-session process name… it would fail.
Now.. there are a lot of scripts and programs upstream which try to detect things a certain way in an effort to run in some environments and not others. Many of them rely on DESKTOP_SESSION.
So, the main reasons to redesign session management in MDM were to:
- Make the environment more consistent (i.e. no difference between a session chosen by the user and one selected by default)
- Provide more information to the environment (i.e. have the session manager clearly visible in the process list, and DESKTOP_SESSION reflect the target session)
As added bonuses:
- MDM became more configurable
- Session management worked much better than before
- As a result of reviewing the code and redesigning it, we got rid of more than a thousand lines (that’s important for a big project like MDM)
The way it works now
MDM now only ever uses x-session-manager as a last resort, when it’s unable to find a valid session it looks at the following and stops as soon as it finds one:
- Your ~/.dmrc file
- The value of “DefaultSession” in the MDM configuration (ignored if set to “auto”)
- The value of “DefaultSessions” in the MDM configuration. This is a coma-delimited list, where sessions are checked one after the other and the first one to be valid is selected.
This, along with the fact that MDM now supports /usr/share/mdm/distro.conf, allows distributions to define which sessions are detected and in which order of preferences when shipping with multiple environments.