30

I'm a Linux and KDE user, and recently I started to use also Enlightenment as a substitute Desktop environment when I need a lighter resource consumption.

I use KDM as a display manager, and I need to find a way to correctly set the default desktop environment to my preferences.

I wish to be able to set KDE as the default choice because I use it on a daily basis, and manually pick a different one just when I need it.

Currently it is set to boot the last used DE, and I can't find how to change this behaviour. The KDM control module in KDE System Settings does not seem to offer me this option.

Any clues on how can I do it?

5
  • Can't you chose a DE before logging in? There should be a session menu or similar that allows you to chose the session you want to run.
    – terdon
    Dec 9 '13 at 15:59
  • Yes, but I've set it up to automatically login with my account, without asking for a specific user (I'm the only user of the computer).
    – Sekhemty
    Dec 9 '13 at 16:43
  • I don't think there is a way to both log in automatically and be able to chose a session.
    – terdon
    Dec 9 '13 at 16:47
  • 1
    I understand. But if it automatically logins in the last used environment, there should be some place where the system is told to behave like this, where it must check what was the last used and then to select it.
    – Sekhemty
    Dec 9 '13 at 16:52
  • And, in your experience, is this behaviour specifically related to my display manager (KDM) or it's a setting that has nothing to do with it? Should I expect to have the same situation also with, in example, LightDM?
    – Sekhemty
    Dec 9 '13 at 16:55
25

You should be able to set this up by editing your $HOME/.dmrc file. The sessions available to your display manager (whichever one you use) are .desktop files normally located in /usr/share/xsessions. In my case, this directory contains:

$ ls /usr/share/xsessions
cinnamon2d.desktop  gnome-fallback.desktop  openbox-gnome.desktop  xfce.desktop
cinnamon.desktop    mate.desktop            openbox-kde.desktop
gnome.desktop       openbox.desktop         ssh.desktop

Any of those files is a possible session that my display manager can choose. Which one is controlled by the $HOME/.dmrc file. So, to make KDE the default, you would have to edit that file and make it look like this:

[Desktop]
Session=kde-plasma

That assumes that you have a kde.desktop file in the xsessions directory, I don't use KDE so I can't check but it works for me using cinnamon or xfce. Once you have made that change, you should be logged in to KDE by default every time.

9
  • 1
    Thank you. You like many different environments yourself, don't you? :) Anyway, in my system, in the /usr/share/xsessions, the KDE entry is named kde-plasma.desktop; I suppose that this is because KDE also provides other environments (i.e. the Active for mobile devices) besides Plasma, the standard for desktops. Since I haven't modified anything here, I'm quite sure that it's the standard name; you might want to upgrade your answer to reflect this. I will try out this procedure and see if it works.
    – Sekhemty
    Dec 9 '13 at 17:34
  • @Sekhemty thanks, answer edited. It should work, I installed kdm just for you :) and tested by switching between cinnamon and xfce, it logged me into the default each time.
    – terdon
    Dec 9 '13 at 17:45
  • Already done, at least for me it is shown as accepted. Maybe the server has not yet updated the status?
    – Sekhemty
    Dec 9 '13 at 20:33
  • @Sekhemty damn, sorry, just noticed your rep level and realized you already know how the site works :). Yup, all accepted here too, thanks!
    – terdon
    Dec 9 '13 at 20:36
  • 3
    does not work for me.I'm using CentOS 7. having gnome-classic.desktop, gnome.desktop, mate.desktop. set Session=mate but does not work
    – vee
    Dec 11 '15 at 14:30
10

In GNOME 2, the .dmrc file in the user home directory was used to create default sessions. This .dmrc file is no longer used.

To specify a default session for a user, update the user’s account service in the /var/lib/AccountsService/users/*username* file:

[User]
Language=
XSession=mate

Source

1
  • My /var/lib/AccountsService/users/*username* contains "Session=" and "XSession=" variables. Should I set them both? Feb 12 at 11:45
3

Works for Centos 7/RHEL If $HOME/.dmrc doesn't exists:

  1. From dir /usr/share/xsessions move all *.desktop file to another directory(unnecessary_env, for example) and leave only one you need(in my case - xfce.desktop):

    $ ls /usr/share/xsessions xfce.desktop unnecessary_env/

  2. After logout/reboot XFCE will be loaded by default

Note! You won't be able to choose between GUI

3
  • My default desktop environment is not under /usr/share/xsessions. I'm on kali Linux and see System X11 Default and gnome-classic as options. But in xsessions, only gnome-classic.desktop exists. Any tips..?
    – borizzzzz
    Jun 15 '19 at 15:24
  • 1
    Whatever I tried, Kali would keep using GNOME as default, moving the unnecessary *.desktop files out of /usr/share/xsessions was the only reliable method to force Kali to use Cinnamon by default. Thanks!
    – Tox
    Jan 26 '20 at 12:54
  • Same for me, it was the unique way to switch from budgie to cinnamon as default desktop in Ubuntu 20.04 LTS
    – serfer2
    Aug 7 at 14:58
2

For RHEL/CentOS 7 you can set the file /etc/sysconfig/desktop to contain DESKTOP=KDE which will default it to KDE.

This also works for VNC.

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.