How to set a default desktop environment at system start?

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?


Solution 1:

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.

Solution 2:

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