Difference between revisions of "SLiM"

From ArchWiki
Jump to: navigation, search
(flagged broken section links (interactive))
(Tag: wiki-scripts)
 
(79 intermediate revisions by 30 users not shown)
Line 2: Line 2:
 
[[cs:SLiM]]
 
[[cs:SLiM]]
 
[[es:SLiM]]
 
[[es:SLiM]]
 +
[[fi:SLiM]]
 
[[fr:SLiM]]
 
[[fr:SLiM]]
 
[[hu:SLiM]]
 
[[hu:SLiM]]
Line 13: Line 14:
 
[[zh-CN:SLiM]]
 
[[zh-CN:SLiM]]
 
[[zh-TW:SLiM]]
 
[[zh-TW:SLiM]]
{{Article summary start}}
+
{{Related articles start}}
{{Article summary text|Provides an overview of the Simple Login Manager.}}
+
{{Related|Display manager}}
{{Article summary heading|Related}}
+
{{Related articles end}}
{{Article summary wiki|Display Manager}}
+
{{Warning|The SliM project has been abandoned (the [http://slim.berlios.de/ project homepage] is down, leaving a [https://github.com/data-modul/slim github mirror]), and is not fully compatible with [[systemd]], including ''logind'' sessions. Consider using a different [[Display manager]] or [[Xinitrc]].}}
{{Article summary end}}
+
  
[http://slim.berlios.de/ SLiM] is an acronym for Simple Login Manager. SLiM is simple, lightweight and easily configurable. SLiM is used by some because it does not require the dependencies of [[GNOME]] or [[KDE]] and can help make a lighter system for users that like to use lightweight desktops like [[Xfce]], [[Openbox]], and [[Fluxbox]].
+
[http://sourceforge.net/projects/slim.berlios/ SLiM] is an acronym for '''S'''imple '''L'''og'''i'''n '''M'''anager. 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]].
  
 
== Installation ==
 
== Installation ==
  
[[pacman|Install]] {{pkg|slim}} from the [[official repositories]].
+
[[Install]] the {{pkg|slim}} package.
  
 
== Configuration ==
 
== Configuration ==
 +
 +
{{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 {{ic|sessiondir /usr/share/xsessions/}} in {{ic|/etc/slim.conf}}. It will therefore be necessary for those who installed an earlier version of SLiM to amend {{ic|/etc/slim.conf}} and [[xinitrc]], accordingly.
  
 
=== Enabling SLiM ===
 
=== Enabling SLiM ===
  
{{Note|{{pkg|slim}} no longer has ConsoleKit support, but relies on systemd-logind, and the system being booted with systemd.}}
+
{{Note|{{pkg|slim}} relies on ''systemd-logind''.}}
  
Enable the '''slim''' [[Daemons|daemon]]. With systemd, it is no longer possible to start slim using {{ic|inittab}}.
+
[[Enable]] the SLiM service {{ic|slim.service}}. This assumes a previously enabled display manager was disabled first. Otherwise, change the [[Systemd#Change_default_target_to_boot_into|default target]].
  
=== Single environments ===
+
=== Environments ===
  
To configure SLiM to load a particular environment, edit your {{ic|~/.xinitrc}} to load your desktop environment:
+
{{Accuracy|Contradicts [[#Configuration]], are these instructions for earlier versions?}}
  
{{bc|
+
{{Note|Available sessions for selection can be cycled through by pressing the '''F1''' key.}}
#!/bin/sh
+
  
#
+
{{tip|Users that have installed a previous version of SLiM can replace {{ic|session}} with a hashed {{ic|sessiondir /usr/share/xsessions/}}}}
# ~/.xinitrc
+
#
+
# Executed by startx (run your window manager from here)
+
#
+
  
exec <session-command>
+
To configure SLiM 1.3.6-2 (or later) to load a particular environment, it will be necessary to edit both {{ic|/etc/slim.conf}} and {{ic|~/.xinitrc}}.
}}
+
  
Replace {{ic|<session-command>}} with the appropriate session command. Some examples of different desktop start commands:
+
First, edit {{ic|/etc/slim.conf}} in order to hash out {{ic|sessiondir /usr/share/xsessions/}}. This will consequently disable automatic detection of installed environments:
  
{{bc|
+
# Set directory that contains the xsessions.
exec awesome
+
# slim reads xsesion from this directory, and be able to select.
exec dwm
+
# sessiondir            /usr/share/xsessions/
exec startfluxbox
+
exec fvwm2
+
exec gnome-session
+
exec openbox-session
+
exec startkde
+
exec startlxde
+
exec startxfce4
+
exec enlightenment_start
+
}}
+
  
For detailed instructions on how to start the various environments, refer to the appropriate wiki pages.
+
Users who installed a prior version of SLiM will have to replace {{ic|sessions}} with the new command.
  
SLiM reads the local {{ic|~/.xinitrc}} configuration and then launches the desktop according to what is in that file. If you do not have a {{ic|~/.xinitrc}} file, you can use the skeleton file by:
+
Second, edit [[xinitrc]].
  
$ cp /etc/skel/.xinitrc ~
+
Users who installed a prior version of SLiM will have to replace {{ic|case $1 in [...] esac}}, where used. To clarify, below is an example of the deprecated method to select multiple sessions. The entire code provided below would simply be replaced with {{ic|exec $1}}:
  
Remember to make {{ic|~/.xinitrc}} executable:
+
DEFAULTSESSION=openbox-session
 +
 +
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 ;;
 +
esac
  
chmod +x ~/.xinitrc
+
=== Set default username ===
  
=== Autologin ===
+
SLiM can be configured to automatically set a desired username, which will therefore already be completed. The password field will also already be focused by default. Change the following line in {{ic|/etc/slim.conf}}:
  
To make SLiM automatically login as a specified user (without having to type a password) the following lines in {{ic|/etc/slim.conf}} should be changed.
 
 
  # default_user        simone
 
  # default_user        simone
  
Uncomment this line, and change "simone" to the user to be logged into automatically.
+
Uncomment this line, and change "simone" to the username of choice:
 
+
# auto_login          no
+
 
+
Uncomment this line and change the 'no' to 'yes'. This enables the auto login feature.
+
 
+
=== Zsh ===
+
{{Note|If you don't know what is zsh and you did not install it - ignore this paragraph.}}
+
 
+
The default login command will not initialize your environment correctly [http://www.edsel.nu/2010/06/04/slim-simple-login-manager-on-freebsd/ [source]]. Change the login_cmd line in {{ic|/etc/slim.conf}} to:
+
 
+
#login_cmd          exec /bin/sh - ~/.xinitrc %session
+
login_cmd          exec /bin/zsh -l ~/.xinitrc %session
+
 
+
=== Multiple environments ===
+
  
To be able to choose from multiple desktop environments, SLiM can be setup to log you into whichever you choose.
+
default_user        ''your username''
  
Put a case statement similar to this one in your {{ic|~/.xinitrc}} file and edit the sessions variable in {{ic|/etc/slim.conf}} to match the names that trigger the case statement. You can cycle through sessions at login time by pressing F1. Note that this feature is experimental.
+
=== Enable Autologin ===
  
{{bc|1=
+
{{Note|It will be necessary to have first set SLiM to use a single desktop environment, as well as a default username.}}
# Adapted from: http://svn.berlios.de/svnroot/repos/slim/trunk/xinitrc.sample
+
  
case $1 in
+
{{Warning|Do '''not''' set this for the '''root''' account.}}
kde)
+
exec startkde
+
;;
+
xfce4)
+
exec startxfce4
+
;;
+
wmaker)
+
exec wmaker
+
;;
+
blackbox)
+
exec blackbox
+
;;
+
icewm&#124;*)
+
icewmbg &
+
icewmtray &
+
exec icewm
+
;;
+
esac
+
}}
+
  
{{Note|<nowiki>In the latest version (1.3.5), slim does not preset any default session, so using a DEFAULT_SESSION variable will not work the way it used to. Instead put your default session as the last case and |*) to the statement (see above)</nowiki>}}
+
{{Warning|1=If auto login is enabled, the GNOME keyring will not be unlocked automatically on login. This will cause dependent applications, such as Chrome/Chromium and NetworkManager, to misbehave (see https://bbs.archlinux.org/viewtopic.php?id&#61;167579).}}
  
=== Themes ===
+
Edit {{ic|/etc/slim.conf}} to uncomment the {{ic|auto_login}} command and replace  {{ic|no}} with {{ic|yes}}:
  
Install the {{Pkg|slim-themes}} package:
+
auto_login          yes
  
# pacman -S slim-themes archlinux-themes-slim
+
=== Theming ===
  
The {{Pkg|archlinux-themes-slim}} packages contains several different themes ([http://imageshack.us/photo/my-images/27/slimthemes.png/ slimthemes.png]). Look in the directory of {{ic|/usr/share/slim/themes}} to see the themes available. Enter the theme name on the {{ic|current_theme}} line in {{ic|/etc/slim.conf}}:
+
[[Install]] the {{Pkg|slim-themes}} package. The {{Pkg|archlinux-themes-slim}} packages contains several different themes ([https://sr.ht/bbe6.png slimthemes.png]). Look in the directory of {{ic|/usr/share/slim/themes}} to see the themes available. Enter the theme name on the {{ic|current_theme}} line in {{ic|/etc/slim.conf}}:
  
 
  #current_theme      default
 
  #current_theme      default
Line 161: Line 127:
 
  input_panel_y          400
 
  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 [http://slim.berlios.de/themes_howto.php very simple and clear official documentation about slim themes] for further details.
+
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 [https://web.archive.org/web/20140414001555/http://slim.berlios.de/themes_howto.php very simple and clear official documentation about slim themes] for further details.
  
 
== Other options ==
 
== Other options ==
 
A few things you might like to try.
 
  
 
=== Changing the cursor ===
 
=== Changing the cursor ===
 
If you want to change the default X cursor to a newer design, the {{AUR|slim-cursor}} package is available.
 
  
 
After installing, edit {{ic|/etc/slim.conf}} and uncomment the line:
 
After installing, edit {{ic|/etc/slim.conf}} and uncomment the line:
Line 177: Line 139:
 
This will give you a normal arrow instead. This setting is forwarded to {{ic|xsetroot -cursor_name}}. You can look up the possible cursor names [http://cvsweb.xfree86.org/cvsweb/*checkout*/xc/lib/X11/cursorfont.h?rev=HEAD&content-type=text/plain here] or in {{ic|/usr/share/icons/<your-cursor-theme>/cursors/}}.
 
This will give you a normal arrow instead. This setting is forwarded to {{ic|xsetroot -cursor_name}}. You can look up the possible cursor names [http://cvsweb.xfree86.org/cvsweb/*checkout*/xc/lib/X11/cursorfont.h?rev=HEAD&content-type=text/plain here] or in {{ic|/usr/share/icons/<your-cursor-theme>/cursors/}}.
  
To change the cursor theme being used at the login screen, make a file named {{ic|/usr/share/icons/default/index.theme}} with this content:
+
To change the cursor theme being used at the login screen, see [[Cursor themes#Using an index.theme file .28recommended.29]]{{Broken section link}}.
 
+
[Icon Theme]
+
Inherits=<your-cursor-theme>
+
 
+
Replace <your-cursor-theme> with the name of the cursor theme you want to use (e.g. whiteglass).
+
  
 
=== Match SLiM and Desktop Wallpaper ===
 
=== Match SLiM and Desktop Wallpaper ===
Line 199: Line 156:
 
* For reboot, enter '''reboot''' as the username
 
* For reboot, enter '''reboot''' as the username
 
* To exit to bash, enter '''exit''' 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 {{ic|/etc/slim.conf}} as root to uncomment the {{ic|suspend_cmd}} line and, if necessary modify the suspend command itself (e.g. change {{ic|/usr/sbin/suspend}} to {{ic|sudo /usr/sbin/pm-suspend}}))
+
* For suspend, enter '''suspend''' as the username. Suspend is disabled by default, edit {{ic|/etc/slim.conf}} as root to uncomment the {{ic|suspend_cmd}} line and, if necessary, modify the suspend command itself (by e.g. changing {{ic|/usr/sbin/suspend}} to {{ic|sudo /usr/sbin/pm-suspend}}).
 
+
=== SLiM init error with rc.d daemon ===
+
 
+
If you initialize SLiM with {{ic|/etc/rc.conf}} inside the DAEMONS array and it fails to initialize it's most likely a lock file issue. SLiM creates a lock file in {{ic|/var/lock}} on each initialization, however, in most cases the lock folder in {{ic|/var}} does not exist preventing SLiM from initializing. Check to make sure {{ic|/var/lock}} exists, if it does not you can create it by typing the following:
+
 
+
# mkdir /var/lock/
+
  
 
=== Power-off error with Splashy ===
 
=== 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 {{ic|/etc/slim.conf}} and {{ic|/etc/splash.conf}}; set the {{ic|1=DEFAULT_TTY=7}} same as {{ic|xserver_arguments vt07}}.
+
If you use Splashy and SLiM, sometimes you cannot power-off or reboot from menu in GNOME, Xfce, LXDE or others. Check your {{ic|/etc/slim.conf}} and {{ic|/etc/splash.conf}}; set the {{ic|1=DEFAULT_TTY=7}} same as {{ic|xserver_arguments vt07}}.
  
 
=== Power-off tray icon fails ===
 
=== 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 {{ic|/etc/slim.conf}} as follows:
 
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 {{ic|/etc/slim.conf}} as follows:
 +
 
  sessionstart_cmd /path/to/tray/icon/program &
 
  sessionstart_cmd /path/to/tray/icon/program &
  
Line 234: Line 186:
 
   sessionstart_cmd /usr/bin/beep -f 659 -l 460 -n -f 784 -l 340 -n -f 659 -l 230 -n -f 659 -l 110
 
   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 ===
+
=== Gnome Keyring ===
If you are using SLiM to launch a Gnome session and have trouble accessing your keyring, for example not being automatically authenticated on login, add the following lines to {{ic|/etc/pam.d/slim}} (as discussed [https://bugs.archlinux.org/task/18637 here]).
+
auth      optional    pam_gnome_keyring.so
+
session    optional    pam_gnome_keyring.so    auto_start
+
 
+
You also have to add to {{ic|/etc/pam.d/passwd}}:
+
password        optional        pam_gnome_keyring.so
+
 
+
If you use a screensaver you also have to add
+
auth    optional        pam_gnome_keyring.so
+
to {{ic|/etc/pam.d/gnome-screensaver}} for example (replace {{ic|gnome-screensaver}} with {{ic|slimlock}}, {{ic|slock}}, whatever you use). If you don't do that, your keyring is locked when screen is locked by your screensaver and not unlocked again after logging back in.
+
 
+
However, this fix alone no longer works since Gnome 2.30. Further changes are necessary as described [https://bugs.archlinux.org/task/18930 here]. Modifying the {{ic|login_cmd}} line in {{ic|/etc/slim.conf}}:
+
login_cmd exec dbus-launch /bin/bash -login ~/.xinitrc %session >~/.xsession-errors 2>&1
+
 
+
As of GNOME 3.4, you need to edit {{ic|<nowiki>/etc/pam.d/{slim,passwd}</nowiki>}} as mentioned above, so that {{ic|<nowiki>/etc/pam.d/slim</nowiki>}} looks like:
+
#%PAM-1.0
+
auth            requisite      pam_nologin.so
+
auth            required        pam_env.so
+
auth            required        pam_unix.so
+
auth            optional        pam_gnome_keyring.so
+
account        required        pam_unix.so
+
session        required        pam_limits.so
+
session        required        pam_unix.so
+
session        optional        pam_gnome_keyring.so auto_start
+
password        required        pam_unix.so
+
and {{ic|<nowiki>/etc/pam.d/passwd</nowiki>}}
+
#%PAM-1.0
+
password required pam_unix.so sha512 shadow nullok
+
password optional pam_gnome_keyring.so
+
As of 2012-10-13, {{ic|<nowiki>/etc/pam.d/gnome-screensaver</nowiki>}} already contains the {{ic|<nowiki>pam_gnome_keyring.so</nowiki>}} instruction.
+
 
+
The correct positioning of the {{ic|<nowiki>pam_gnome_keyring.so</nowiki>}} instructions were taken from [http://live.gnome.org/GnomeKeyring/Pam here].
+
 
+
After editing the above files, you need to edit {{ic|<nowiki>/etc/inittab</nowiki>}}.
+
 
+
The solutions mentioned here and also further information are found [http://live.gnome.org/GnomeKeyring/Pam here].
+
 
+
If you have problems keeping the keyring unlocked for longer sessions, there is another thing that Gnome does:
+
Look at {{ic|<nowiki>/etc/xdg/autostart/{gnome-keyring-gpg.desktop, gnome-keyring-pkcs11.desktop, gnome-keyring-secrets.desktop, gnome-keyring-ssh.desktop}</nowiki>}}.
+
 
+
Append the following lines to .xinitrc just before you start your wm (example here is awesome wm):
+
/usr/bin/gnome-keyring-daemon --start --components=gpg
+
/usr/bin/gnome-keyring-daemon --start --components=pkcs11
+
/usr/bin/gnome-keyring-daemon --start --components=secrets
+
/usr/bin/gnome-keyring-daemon --start --components=ssh
+
/usr/bin/awesome
+
  
After login check if there is only one gnome-keyring-daemon instance running ({{ic|ps -A | grep gnome}}). If those lines are executed too early then you have 4 instances running which is not good.
+
{{Note|slim 1.3.5-1 ships with {{ic|/etc/pam.d/slim}} preconfigured to unlock keyring upon login. Users no longer need to modify the file.}}
 +
{{Warning|1=If auto login is enabled, the GNOME keyring will not be unlocked automatically on login. This will cause dependent applications, such as Chrome/Chromium and NetworkManager, to misbehave (see https://bbs.archlinux.org/viewtopic.php?id=167579).}}
  
You also should notice that seahorse for example does not show any pkcs11 errors anymore and that your keyring is unlocked all the time and does not lock itself anymore. Finally {{pkg|gnome-keyring}} is fully functional like in Gnome. See also [https://bbs.archlinux.org/viewtopic.php?pid=1019845#p1019845 here].
+
See [[GNOME Keyring#Use without GNOME, and without a display manager]]{{Broken section link}} to use GNOME Keyring in a custom session.
  
 
=== Setting DPI with SLiM ===
 
=== 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 {{ic|/etc/X11/xinit/xserverrc}} it will not work with SLiM. To fix this change your {{ic|slim.conf}} from:
+
The Xorg server generally picks up the DPI but if it does not you can specify it to SLiM. If you set the DPI with the argument -dpi 96 in {{ic|/etc/X11/xinit/xserverrc}} it will not work with SLiM. To fix this change your {{ic|slim.conf}} from:
  
 
   xserver_arguments  -nolisten tcp vt07  
 
   xserver_arguments  -nolisten tcp vt07  
Line 300: Line 207:
 
Use the {{ic|current_theme}} variable as a comma separated list to specify a set from which to choose. Selection is random.
 
Use the {{ic|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===
+
=== 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 {{ic|/etc/slim.conf}} file. Just a few lines down you should see:
+
If tty terminals 3-6 are not used and commented out (You may use screen and therefore only need one terminal), change {{ic|/etc/slim.conf}} to move the X server:
 +
 
 
  xserver_arguments -nolisten tcp vt07
 
  xserver_arguments -nolisten tcp vt07
  
Simply change the vt07 to lets say vt03 as there is no agetty started there.
+
Simply change the vt07 to for example vt03 as no agetty is started there.
  
 
=== Automatically mount your encrypted /home on login ===
 
=== Automatically mount your encrypted /home on login ===
  
You can use [[Pam_mount#Slim|pam_mount]].
+
See [[Pam_mount#SLiM|pam_mount]].
 +
 
 +
=== Change Keyboard Layout ===
 +
 
 +
Edit {{ic|/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''"'''
 +
EndSection
  
 
== All Slim Options ==
 
== All Slim Options ==
 +
 
Here is a list of all the slim configuration options and their default values.
 
Here is a list of all the slim configuration options and their default values.
  
{{Note|welcome_msg allows 2 variables '''%host''' and '''%domain'''<br>sessionstart_cmd allows '''%user''' ''(execd right before login_cmd)'' and it is also allowed in sessionstop_cmd<br>login_cmd allows '''%session''' and '''%theme'''}}
+
{{Note|{{ic|welcome_msg}} allows 2 variables '''%host''' and '''%domain'''
 +
 
 +
{{ic|sessionstart_cmd}} allows '''%user''' (executed right before login_cmd) and it is also allowed in {{ic|sessionstop_cmd}}
 +
 
 +
{{ic|login_cmd}} allows '''%session''' and '''%theme'''}}
  
 
{| class="wikitable collapsible collapsable collapsed"
 
{| class="wikitable collapsible collapsable collapsed"
Line 370: Line 297:
 
| reboot_msg ||{{ic|The system is rebooting...}}
 
| reboot_msg ||{{ic|The system is rebooting...}}
 
|-
 
|-
| sessions ||{{ic|wmaker,blackbox,icewm}}
+
| sessiondir ||{{ic| /usr/share/xsessions/}}
|-
+
| sessiondir ||
+
 
|-
 
|-
 
| hidecursor ||{{ic|false}}
 
| hidecursor ||{{ic|false}}
Line 482: Line 407:
 
| session_shadow_color ||{{ic|#FFFFFF}}
 
| session_shadow_color ||{{ic|#FFFFFF}}
 
|}
 
|}
== Uninstallation ==
 
To completely remove SLiM:
 
{{bc| # pacman -Rns slim
 
# rm /etc/systemd/system/display-manager.service
 
}}
 
== See also ==
 
  
* [http://slim.berlios.de/ SLiM homepage]
+
==Troubleshooting==
* [http://slim.berlios.de/manual.php SLiM documentation]
+
 
 +
===Shutdown or Reboot Stalled===
 +
 
 +
There is a bug or known issue with the combination of SLiM, Xfce and systemd that does not let the system to properly shutdown and systemd waits for the SLiM service to end, but eventually is terminated.
 +
 
 +
To accelerate the shutdown process these lines might help when added to /usr/lib/systemd/system/slim.service:
 +
 
 +
[Service]
 +
ExecStart=/usr/bin/slim -nodaemon
 +
Restart=on-failure
 +
TimeoutStopSec=5s
 +
IgnoreSIGPIPE=no
 +
ExecStop=/bin/kill -TERM -${MAINPID}
 +
 
 +
See {{Bug|32380}}.
 +
 
 +
== See also ==
 +
* [http://sourceforge.net/projects/slim.berlios/ SLiM on SourceForge]
 +
* [https://github.com/data-modul/slim SLiM on GitHub]

Latest revision as of 10:52, 7 August 2016

Related articles

Warning: The SliM project has been abandoned (the project homepage is down, leaving a github mirror), and is not fully compatible with systemd, including logind sessions. Consider using a different Display manager or Xinitrc.

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.

Installation

Install the slim package.

Configuration

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.

Enabling SLiM

Note: slim relies on systemd-logind.

Enable the SLiM service slim.service. This assumes a previously enabled display manager was disabled first. Otherwise, change the default target.

Environments

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Contradicts #Configuration, are these instructions for earlier versions? (Discuss in Talk:SLiM#)
Note: Available sessions for selection can be cycled through by pressing the F1 key.
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/

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

Second, edit xinitrc.

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 deprecated method to select multiple sessions. The entire code provided below would simply be replaced with exec $1:

DEFAULTSESSION=openbox-session

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 ;;
esac

Set default username

SLiM can be configured to automatically set a desired username, which will therefore already 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.
Warning: If auto login is enabled, the GNOME keyring will not be unlocked automatically on login. This will cause dependent applications, such as Chrome/Chromium and NetworkManager, to misbehave (see https://bbs.archlinux.org/viewtopic.php?id=167579).

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

auto_login          yes

Theming

Install the slim-themes package. 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, see Cursor themes#Using an index.theme file .28recommended.29[broken link: invalid section].

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 (by e.g. changing /usr/sbin/suspend to sudo /usr/sbin/pm-suspend).

Power-off error with Splashy

If you use Splashy and SLiM, sometimes you cannot 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

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.
Warning: If auto login is enabled, the GNOME keyring will not be unlocked automatically on login. This will cause dependent applications, such as Chrome/Chromium and NetworkManager, to misbehave (see https://bbs.archlinux.org/viewtopic.php?id=167579).

See GNOME Keyring#Use without GNOME, and without a display manager[broken link: invalid section] to use GNOME Keyring in a custom session.

Setting DPI with SLiM

The Xorg server generally picks up the DPI but if it does not 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 

to

 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

If tty terminals 3-6 are not used and commented out (You may use screen and therefore only need one terminal), change /etc/slim.conf to move the X server:

xserver_arguments -nolisten tcp vt07

Simply change the vt07 to for example vt03 as no agetty is started there.

Automatically mount your encrypted /home on login

See 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"
EndSection

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 (executed right before login_cmd) and it is also allowed in sessionstop_cmd

login_cmd allows %session and %theme

Troubleshooting

Shutdown or Reboot Stalled

There is a bug or known issue with the combination of SLiM, Xfce and systemd that does not let the system to properly shutdown and systemd waits for the SLiM service to end, but eventually is terminated.

To accelerate the shutdown process these lines might help when added to /usr/lib/systemd/system/slim.service:

[Service]
ExecStart=/usr/bin/slim -nodaemon
Restart=on-failure
TimeoutStopSec=5s
IgnoreSIGPIPE=no
ExecStop=/bin/kill -TERM -${MAINPID}

See FS#32380.

See also