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?

5

4 Answers

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

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

2

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

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

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest