Manjaro SLiM Configuration

SLiM Configuration

From Manjaro
Revision as of 17:10, 24 December 2012 by imported>Verityproductions

Overview


Note
It will likely be necessary to manually edit the SLiM configuration file and the X-Windows initialisation file whenever a new desktop is added or an old one is removed. However, as illustrated below, it is possible to pre-configure SLiM to automatically work with multiple desktop environments.


SLiM - the Simple Login Manager - is not currently pre-installed with any Manjaro flavour. However, due to popular demand, it has still been made available for download and installation from the official Manjaro repositories. SLiM is responsible for providing the login screen, where your preferred desktop environment may be selected for your personal user account(s). It also functions as a protective security barrier to prevent unauthorised access to your system.

Although SLiM is highly configurable with an abundance of extra themes available, it is also perhaps suited to more experienced users. This is primarily due to the fact that whereas other display managers such as LXDM will automatically detect installed desktop environments, SLiM does not and so must be manually configure to work with them.

Configuring SLiM to Start Desktop Environments

Tip
Don't worry if it transpires that SLiM has been mis-configured in some way, and it is not consequently possible to actually get past the login screen. There are a list of commands below that can be used in SLiM, including returning to the command line or launching a terminal.


Once SLiM has been installed and enabled, it will be necessary to manually edit both the SLiM configuration file and the X-Windows initialisation file in order to actually start your installed desktop environment(s). If these files are not edited - or not edited properly - then it is likely that you will not be able to proceed any further than the login screen itself.


Open the SLiM Configuration File

The purpose of editing this file is to add the name(s) of your installed desktop environment(s). SLiM will then pass these name(s) to the X-Windows initialisation file (.xinitrc), which in turn will actually start your desired desktop environment(s). You will need to first open your terminal in order to edit the SLiM configuration file. The syntax of the command to do this is:

sudo [text editor] /etc/slim.conf


For example, if you wish to edit the file within the terminal using nano (a standard terminal-based text editor) then enter:

sudo nano /etc/slim.conf


Otherwise - if you have installed the full version of Manjaro (i.e. not the NET-Edition) - you may find it easier to use the pre-installed gedit text editor instead. This will open the configuration file up as a document, making it easier to read and edit. To use gedit instead, the command is:

sudo gedit /etc/slim.conf


Add Desktop Environments to the SLiM Configuration File

Once the SLiM configuration file has been opened, it will be necessary to add the name(s) of your installed desktop(s) in order to:

  • display the name(s) of your desktop(s) on the login screen - which is helpful if you want to know which one you are switching to, and
  • to tell the .xinitrc file which desktop it is to start


This is undertaken in the # Available Sessions section, located towards the middle of the file. In the example below, all the available desktops have been added. The text itself has been colured in green for illustrative purposes.

# Available sessions (first one is the default).
# The current chosen session name is replaced in the login_cmd
# above, so your login command can handle different sessions.
# see the xinitrc.sample file shipped with slim sources
sessions            xfce,gnome3,kde,cinnamon,razor-qt,openbox,lxde,mate 


As illustrated, if two or more desktops are listed, they must be seperated with a comma (,). In addition, as stated, the first desktop listed will be the default. This means that if you do not choose which desktop you want on the login screen, the name of the default one will be automatically sent to the .xinitrc file. You do not have to add all of the desktops listed in the above illustration.


Once your amendments have been completed, save your changes and close the configuration file by:

  • nano: Press CTRL and 'x' to exit, 'y' to save, and <enter> to finish, or
  • gedit: Select the 'save' option and then close the window.


The next - and final - step necessary is to edit and configure the X-Windows Initialisation File.


Open the X-Windows Initialisation File

The .xinitrc is responsible for actually starting your installed desktop environment(s). In essence, the .xinitrc file will take the name of your chosen (or only) desktop environment from SLiM, and then use that to determine which command to use to actually start it. You will need to first open your terminal in order to edit the X-Windows initialisation file. The syntax of the command to do this is:

sudo [text editor] ~/.xinitrc


Don't forget the dot. For example, if you wish to edit the file within the terminal using nano, then enter:

sudo nano ~/.xinitrc


Otherwise you could use the gedit text editor instead, by entering the command:

sudo gedit ~/.xinitrc


Add Desktop Environments to the X-Windows Initialisation File

Again, the purpose of editing this file is to:

  • list the name(s) (or labels) of your installed desktop environment(s) from the SLiM configuration file, and
  • match those name(s) with the command(s) necessary to actually start the desktop environment(s)


The key point to keep in mind is that the name(s) of the desktop(s) listed in the SLiM configuration file must be matched with those listed in the X-Windows Initialisation file. As such, it is therefore vitally important that the name of any given desktop environment is listed EXACTLY the same way in both files. This includes the use of captial and lower-case letters. Should there by any difference at all, then there will not be a match, and your chosen desktop environment will not be started. The names and commands themselves must be added after the DEFAULTSESSION= command. All the names used in the SLiM configuration file above have been listed exactly the same way here, and have been colured in green for illustrative purposes.

#!/bin/sh

#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#

export GTK2_RC_FILES="$HOME/.gtkrc-2.0"

DEFAULTSESSION=xfce4-session

case "$1" in
     xfce) exec xfce4-session ;;
     gnome3) exec gnome-session ;;
     kde) exec startkde ;;
     cinnamon) exec gnome-session-cinnamon ;;
     razor-qt) exec razor-session ;;
     openbox) exec openbox-session ;;
     lxde) exec lxsession ;;
     mate) exec mate-session ;;
     *) exec $DEFAULTSESSION ;;
esac

The default session has been set to xfce4 in this instance as the author's Manjaro installation came with that desktop environment pre-installed. Yours may be different, and you are entirely free to change it if you wish. Note that each line starting with green text:

1. starts with the name of the desktop environment

2. uses the command exec which means execute (i.e. start), and

3. ends with the actual command necessary to start a desktop environment appropriate to the name


The exception is the last line which begins with an asterisk ('*' - a wildcard). This is to ensure that if a match is not found, then the default session will be started instead - which in this instance, is xfce4. Again, if the name of a desktop environment listed in this file does not exactly match a name passed to it by the SLiM configuration file, then the actual command to start that desktop cannot be executed.

If you wish, you are free to use the entire example provided in your own .xinitrc file, even if you do not have all of these desktop environments installed. Doing so will not cause any problems, and can make life much easier if you decide to install any new desktops at a future point (i.e. it will only be necessary to edit the SLiM configuration file). Otherwise you may just delete the lines for any desktop environments that you do not have installed.


Once your amendments have been completed, save your changes and close the configuration file by:

  • nano: Press CTRL and 'x' to exit, 'y' to save, and <enter> to finish, or
  • gedit: Select the 'save' option and then close the window.


Now reboot the system for the changes to take effect.


Selecting Multiple Desktop Environments

Where two or more desktop environments have be installed - and consequently enabled by editing the above files - then they can be cycled and selected by pressing the F1 key on the SLiM login screen.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.