From ArchWiki
Revision as of 11:26, 24 February 2014 by (talk | contribs) (update link(s) (avoid redirect))
Jump to: navigation, search

zh-CN:SLiM zh-TW:SLiM

Warning: Currently SLiM is not fully compatible with Systemd, resulting in various problems on a second login. See Display manager#Incompatibility with systemd for an outline of these problems.

SLiM is an acronym for Simple Login Manager. Lightweight and easily configurable, SLiM requires minimal dependencies, and none from the GNOME or KDE desktop environments. It therefore contributes towards a lightweight system for users that also like to use lightweight desktops such as Xfce, Openbox, and Fluxbox.


Install slim from the official repositories.


Note: SLiM no longer supports a 'default' session where multiple sessions have been enabled. This is most noticable where attempting to log out and back in again to the same session.

As of version 1.3.6-2, SLiM can automatically detect installed desktop environments and window managers. This is achieved through the use of sessiondir /usr/share/xsessions/ in /etc/slim.conf. It will therefore be necessary for those who installed an earlier version of SLiM to amend /etc/slim.conf and ~/.xinitrc, accordingly.

.xinitrc file

If you do not have a ~/.xinitrc file, then either create one in your Home folder using nano or an appropriate text editor (e.g. Leafpad or Geany). Alternatively, you may be able use a skeleton file as a template to work with:

$ cp /etc/skel/.xinitrc ~

Remember to make the ~/.xinitrc file executable if not already:

chmod +x ~/.xinitrc

Enabling SLiM

Note: slim no longer has ConsoleKit support, but relies on systemd-logind, and the system being booted with systemd.

Enter the following command to enable the SLiM daemon: systemctl enable slim.service. This is assuming that a previously installed and enabled display manager had been disabled first. Otherwise, enter systemctl enable slim.service -f to simultaneously disable the existing display manager and activate SLiM in its place.

Single environments

Tip: Users that have installed a previous version of SLiM can replace session with a hashed sessiondir /usr/share/xsessions/

To configure SLiM 1.3.6-2 (or later) to load a particular environment, it will be necessary to edit both /etc/slim.conf and ~/.xinitrc.

First, edit /etc/slim.conf in order to hash out sessiondir /usr/share/xsessions/. This will consequently disable automatic detection of installed environments:

# Set directory that contains the xsessions.
# slim reads xsesion from this directory, and be able to select.
# sessiondir            /usr/share/xsessions/

Second, edit your ~/.xinitrc to set the preferred session:


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

exec <session-command>

Replace <session-command> with the desired session command. Some examples have been provided below:

exec awesome
exec dwm
exec startfluxbox
exec fvwm2
exec gnome-session
exec openbox-session
exec startkde
exec startlxde
exec startxfce4
exec enlightenment_start
exec mate-session

For detailed instructions on how to start any desktop environments or window managers not listed above, refer to their wiki articles.

Multiple environments

Note: Available sessions for selection can be cycled through by pressing the F1 key.

To be able to choose from multiple desktop environments. It will therefore be necessary to amend /etc/slim.conf and ~/.xinitrc. This process will also cover SLiM installations prior to 1.3.6-2.

First, edit /etc/slim.conf in order to ensure that sessiondir /usr/share/xsessions/ is present and unhashed:

# Set directory that contains the xsessions.
# slim reads xsesion from this directory, and be able to select.
sessiondir            /usr/share/xsessions/

Users who installed a prior version of SLiM will have to replace sessions with the new command.

Second, edit ~/.xinitrc so that a selected session is run:

exec $1

Users who installed a prior version of SLiM will have to replace case $1 in [...] esac, where used. To clarify, below is an example of the depreceated method to select multiple sessions. The entire code provided below would simply be replaced with exec $1:


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

Set default username

SLiM can be configured to automatically set a desired username, which will therefore aleady be completed. The password field will also already be focused by default. Change the following line in /etc/slim.conf:

# default_user        simone

Uncomment this line, and change "simone" to the username of choice:

default_user        <your username>

Enable Autologin

Note: It will be necessary to have first set SLiM to use a single desktop environment, as well as a default username.
Warning: Do not set this for the root account.

Edit /etc/slim.conf to uncomment the auto_login command and replace no with yes:

auto_login          yes


Install the slim-themes package:

# pacman -S slim-themes archlinux-themes-slim

The archlinux-themes-slim packages contains several different themes (slimthemes.png). Look in the directory of /usr/share/slim/themes to see the themes available. Enter the theme name on the current_theme line in /etc/slim.conf:

#current_theme       default
current_theme       archlinux-simplyblack

To preview a theme run while an instance of the Xorg server is running by:

$ slim -p /usr/share/slim/themes/<theme name>

To close, type "exit" in the Login line and press Enter.

Additional theme packages can be found in the AUR.

Dual screen setup

You can customize the slim theme in /usr/share/slim/themes/<your-theme>/slim.theme to turn these percents values. The box itself is 450 pixels by 250 pixels:

input_panel_x           50%
input_panel_y           50%

into pixels values:

# These settings set the "archlinux-simplyblack" panel in the center of a 1440x900 screen
input_panel_x           495
input_panel_y           325
# These settings set the "archlinux-retro" panel in the center of a 1680x1050 screen
input_panel_x           615
input_panel_y           400

If your theme has a background picture you should use the background_style setting ('stretch', 'tile', 'center' or 'color') to get it correctly displayed. Have a look at the very simple and clear official documentation about slim themes for further details.

Other options

Changing the cursor

After installing, edit /etc/slim.conf and uncomment the line:

cursor   left_ptr

This will give you a normal arrow instead. This setting is forwarded to xsetroot -cursor_name. You can look up the possible cursor names here or in /usr/share/icons/<your-cursor-theme>/cursors/.

To change the cursor theme being used at the login screen, make a file named /usr/share/icons/default/index.theme with this content:

[Icon Theme]

Replace <your-cursor-theme> with the name of the cursor theme you want to use (e.g. whiteglass).

Match SLiM and Desktop Wallpaper

To share a wallpaper between SLiM and your desktop, rename the used theme background, then create a link from your desktop wallpaper file to the default SLiM theme:

# mv /usr/share/slim/themes/default/background.jpg{,.bck}
# ln -s /path/to/mywallpaper.jpg /usr/share/slim/themes/default/background.jpg

Shutdown, reboot, suspend, exit, launch terminal from SLiM

You may shutdown, reboot, suspend, exit or even launch a terminal from the SLiM login screen. To do so, use the values in the username field, and the root password in the password field:

  • To launch a terminal, enter console as the username (defaults to xterm which must be installed separately... edit /etc/slim.conf to change terminal preference)
  • For shutdown, enter halt as the username
  • For reboot, enter reboot as the username
  • To exit to bash, enter exit as the username
  • For suspend, enter suspend as the username (suspend is disabled by default, edit /etc/slim.conf as root to uncomment the suspend_cmd line and, if necessary modify the suspend command itself (e.g. change /usr/sbin/suspend to sudo /usr/sbin/pm-suspend))

Power-off error with Splashy

If you use Splashy and SLiM, sometimes you can't power-off or reboot from menu in GNOME, Xfce, LXDE or others. Check your /etc/slim.conf and /etc/splash.conf; set the DEFAULT_TTY=7 same as xserver_arguments vt07.

Power-off tray icon fails

If your power off tray icon fails, it could be due to not having root privileges. To start a tray icon with root privileges, be sure to have SLiM start the program. Edit /etc/slim.conf as follows:

sessionstart_cmd 	/path/to/tray/icon/program &

Login information with SLiM

By default, SLiM fails to log logins to utmp and wtmp which causes who, last, etc. to misreport login information. To fix this edit your slim.conf as follows:

 sessionstart_cmd    /usr/bin/sessreg -a -l $DISPLAY %user
 sessionstop_cmd     /usr/bin/sessreg -d -l $DISPLAY %user

Custom SLiM Login Commands

You can also use the sessionstart_cmd/sessionstop_cmd in /etc/slim.conf to log specific infomation, such as the session, user, or theme used by slim:

 sessionstop_cmd /usr/bin/logger -i -t ASKAPACHE "(sessionstop_cmd: u:%user s:%session t:%theme)"
 sessionstart_cmd /usr/bin/logger -i -t ASKAPACHE "(sessionstart_cmd: u:%user s:%session t:%theme)"

Or if you want to play a song when slim loads (and you have the beep program installed)

 sessionstart_cmd /usr/bin/beep -f 659 -l 460 -n -f 784 -l 340 -n -f 659 -l 230 -n -f 659 -l 110

SLiM and Gnome Keyring

Note: slim 1.3.5-1 ships with /etc/pam.d/slim preconfigured to unlock keyring upon login. Users no longer need to modify the file.

See GNOME Keyring#Use Without GNOME if you want to use GNOME Keyring in a custom session.

Setting DPI with SLiM

The Xorg server generally picks up the DPI but if it doesn't you can specify it to SLiM. If you set the DPI with the argument -dpi 96 in /etc/X11/xinit/xserverrc it will not work with SLiM. To fix this change your slim.conf from:

 xserver_arguments   -nolisten tcp vt07 


 xserver_arguments   -nolisten tcp vt07 -dpi 96

Use a random theme

Use the current_theme variable as a comma separated list to specify a set from which to choose. Selection is random.

Move the whole session to another VT

Lets say you have commented out tty terminals 3-6 as you may not use them. (You may use screen and therefore only need one terminal) So, to move the X-Server you need to change one number in the /etc/slim.conf file. Just a few lines down you should see:

xserver_arguments -nolisten tcp vt07

Simply change the vt07 to lets say vt03 as there is no agetty started there.

Automatically mount your encrypted /home on login

You can use pam_mount.

Change Keyboard Layout

Edit /etc/X11/xorg.conf.d/10-evdev.conf, find the following section, add the two bolded lines, and replace dvorak with your preferred keymap:

Section  "InputClass"
          Identifier "evdev keyboard catchall"
          MatchIsKeyboard "on"
          MatchDevicePath "/dev/input/event*"
          Driver "evdev"
          # Keyboard layouts
          Option "XkbLayout" "dvorak"

All Slim Options

Here is a list of all the slim configuration options and their default values.

Note: welcome_msg allows 2 variables %host and %domain
sessionstart_cmd allows %user (execd right before login_cmd) and it is also allowed in sessionstop_cmd
login_cmd allows %session and %theme


To completely remove SLiM:

 # pacman -Rns slim
 # rm /etc/systemd/system/display-manager.service

Known issues

Incompatibility with systemd

See Display manager#Incompatibility with systemd

See also