I have a system with multiple Desktop Environments installed (Ubuntu 14.04 with Unity and Xfce). I would like to configure (with a non-interactive script) a particular DE for a particular user.

How is this controlled? Would it be the same for e.g. KDE?


I figured it out. I'm writing the lightDM configuration when configuring autologin anyway, and that's where I'm specifying the user, so the right thing is to specify the system default at the same time: wiki.ubuntu.com/LightDM#Changing_the_Default_Session

However, when this bug is fixed: https://bugs.launchpad.net/lightdm/+bug/1371710 I'll need a better way to set a per-user default since lightdm won't be reconfigured/restarted for each user autologin.

More data: with lightDM, a desktop preference will be looked up in /var/lib/AccountsService/users/$USER (no good docs, but some tantalizing details here), and if not found will be looked up in $HOME/.dmrc (described here). When a user logs in and chooses a DE, both of these locations are populated. So, a script could provision either of these locations (either using the DBus interface or writing to the AccountService file directly) to set a suitable default for the user.

| improve this answer | |
  • Although your achieving your desired result, remember that that location is dependant upon using GDM. The location may be different for KDM and other login managers. – eyoung100 Oct 2 '14 at 14:00
  • Unfortunately it's worse than that. .dmrc is indeed specified in the GDM "specification", but AccountsService appears to be narrower than that (Debian/Ubuntu only?) and doesn't appear to be supported by GDM. However for lightdm in particular those two locations work. Other Display Managers may indeed use other mechanisms and may not work this way at all. This is a very lightdm-specific solution. – BobDoolittle Oct 2 '14 at 14:06

No configuration controls which desktop is Chosen. If the DE is installed it can be chosen by the user at login using the Session Chooser. I was going to post screenshots, but they are already posted here

| improve this answer | |
  • I don't see how that can be true, because once you choose a configuration, it's the default next time. So that configuration has to be stored somewhere. And if a user can choose/set that configuration themselves (via the Session Chooser), surely that same configuration can be created externally, right? I'm guessing it's a file in the user's home directory, or else a gconf setting. – BobDoolittle Oct 1 '14 at 18:38
  • It depends on what Login Manager you use. IIRC the login manager reads /etc/X11/sessions/, but that only controls which sessions are on the list, not how the DE is configured. – eyoung100 Oct 1 '14 at 18:44
  • eyoung100: I assume you mean Display Manager? Such as lightdm? That's the one I'm particularly interested in. – BobDoolittle Oct 1 '14 at 18:46
  • In particular, I'm setting up an autologin environment with lightdm, so there is no Session Chooser dialog for the user to utilize. – BobDoolittle Oct 1 '14 at 18:49
  • Then you're limited to one session I believe. The user has no say, as Auto-Login is System Wide – eyoung100 Oct 1 '14 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.