Difference between revisions of "SLiM"

From ArchWiki
Jump to navigation Jump to search
m
(update status of external links (interactive))
Tag: wiki-scripts
 
(279 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
[[Category:Display managers (English)]]
+
[[Category:Display managers]]
 +
[[cs:SLiM]]
 +
[[es:SLiM]]
 +
[[fi:SLiM]]
 +
[[fr:SLiM]]
 +
[[hu:SLiM]]
 +
[[it:SLiM]]
 +
[[ja:SLiM]]
 +
[[ko:SLiM]]
 +
[[pt:SLiM]]
 +
[[ru:SLiM]]
 +
[[sk:SLiM]]
 +
[[zh-hans:SLiM]]
 +
[[zh-hant:SLiM]]
 +
{{Related articles start}}
 +
{{Related|Display manager}}
 +
{{Related articles end}}
 +
{{Warning|The SliM project has been abandoned (last release was 2013, the [http://slim.berlios.de/ project homepage] is down), and is not fully compatible with [[systemd]], including ''logind'' sessions. Consider using a different [[Display manager]] or [[Xinitrc]].}}
  
{{i18n_links_start}}
+
[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]].
{{i18n_entry|English|SLIM}}
 
{{i18n_entry|简体中文|SLIM (简体中文)}}
 
{{i18n_entry|Italiano|SLiM (Italiano)}}
 
{{i18n_links_end}}
 
  
=Introduction=
+
== Installation ==
SLiM is an acronym for Simple Login Manager (SLiM). SLiM is simple, lightweight and easily configurable allowing it be used on low and high end systems with relative ease. SLiM is also very convenient for those who want a login manager without the dependencies of Gnome or KDE making it perfect for users running Xfce, Openbox, Fluxbox, etc.
 
  
=Installation=
+
[[Install]] the {{pkg|slim}} package.
SLiM is available from the /extra repositories:
 
# pacman -S slim
 
There is also a themes package:
 
# pacman -S slim-themes
 
  
=Configuration=
+
== Configuration ==
  
==Enabling SLiM==
+
{{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.}}
Refer to [[Adding a login manager (KDM, GDM, or XDM) to automatically boot on startup]].
 
  
==Single Environments==
+
SLiM can automatically detect installed desktop environments and window managers through the use of {{ic|sessiondir /usr/share/xsessions/}} in {{ic|/etc/slim.conf}}. Those upgrading from a version before 1.3.6-2 must amend {{ic|/etc/slim.conf}} and [[xinitrc]], accordingly. See below.
  
To configure SLiM to load a particular environment, simply edit '''~/.xinitrc''' to look like the following:
+
=== Enabling SLiM ===
  
<pre>
+
{{Note|{{pkg|slim}} relies on ''systemd-logind''.}}
#!/bin/sh
 
  
#
+
[[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]].
# ~/.xinitrc
 
#
 
# Executed by startx (run your window manager from here)
 
#
 
  
exec [session-command]
+
=== Environments ===
</pre>
 
  
*Note: If you do not have have a ~/.xinitrc file, you can create one (with, for example, nano).
+
{{Accuracy|Contradicts [[#Configuration]], are these instructions for earlier versions?}}
  
Replace '''''[session-command]''''' with the appropriate session command. For example:
+
{{Note|Available sessions for selection can be cycled through by pressing the '''F1''' key.}}
  
To launch Openbox:
+
{{tip|Users that have installed a previous version of SLiM can replace {{ic|session}} with a hashed {{ic|sessiondir /usr/share/xsessions/}}}}
# Openbox
 
exec openbox-session
 
To launch Fluxbox:
 
# Fluxbox
 
exec fluxbox
 
# Either fluxbox or startfluxbox is acceptable
 
To launch Xfce:
 
# Xfce
 
exec startxfce4
 
To launch GNOME:
 
# GNOME
 
exec gnome-session
 
To launch KDE:
 
# KDE
 
exec startkde
 
If your environment is not listed here, refer to the documentation provided by your software.
 
  
==Multiple Environments==
+
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}}.
If you require the ability to load multiple desktop environments, SLiM can be setup to log you into whichever you choose.
 
  
Put a case statement similar to this one in your ~/.xinitrc file and edit the sessions variable in /etc/slim.conf to match the names that trigger the case statement.
+
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:
You can choose the session at login time by pressing F1. Note that this feature is experimental.
 
  
<pre>
+
# Set directory that contains the xsessions.
# The following variable defines the session which is started if the user doesn't explicitly select a session
+
# slim reads xsesion from this directory, and be able to select.
 +
# sessiondir            /usr/share/xsessions/
  
DEFAULT_SESSION=twm
+
Users who installed a prior version of SLiM will have to replace {{ic|sessions}} with the new command.
  
case $1 in
+
Second, edit [[xinitrc]].
kde)
 
exec startkde
 
;;
 
xfce4)
 
exec startxfce4
 
;;
 
icewm)
 
icewmbg &
 
icewmtray &
 
exec icewm
 
;;
 
wmaker)
 
exec wmaker
 
;;
 
blackbox)
 
exec blackbox
 
;;
 
*)
 
exec $DEFAULT_SESSION
 
;;
 
esac
 
</pre>
 
  
Source for sample: http://svn.berlios.de/svnroot/repos/slim/trunk/xinitrc.sample
+
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}}:
  
Slim documentation: http://slim.berlios.de/manual.php
+
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
  
==Themes==
+
=== Set default username ===
  
Install the slim-themes package:
+
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}}:
  
  pacman -S slim-themes archlinux-themes-slim
+
  # default_user        simone
  
The <tt>archlinux-themes-slim</tt> packages contains several different themes. Check <tt>/usr/share/slim/themes</tt> to see the available variations and other themes available.
+
Uncomment this line, and change "simone" to the username of choice:
  
Edit the current_theme line in /etc/slim.conf from "default" to one of your choice:  
+
default_user        ''your username''
  nano /etc/slim.conf
+
 
 +
=== 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|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).}}
 +
 
 +
Edit {{ic|/etc/slim.conf}} to uncomment the {{ic|auto_login}} command and replace  {{ic|no}} with {{ic|yes}}:
 +
 
 +
  auto_login          yes
 +
 
 +
=== Theming ===
 +
 
 +
[[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
 
  current_theme      archlinux-simplyblack
 
  current_theme      archlinux-simplyblack
To preview a theme, run:
 
  
  slim -p /usr/share/slim/themes/<theme name>
+
You can preview a theme while Xorg is running with:
 +
 
 +
  $ 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]]. See the [https://github.com/iwamatsu/slim/blob/master/THEMES theme documentation] for how to customize your theme or make your own. SLiM does not support alternative theme directories, so it is recommended to [[create a package]] for your custom theme so that [[pacman]] is aware of it.
 +
 
 +
==== Custom background ====
 +
 
 +
SLiM is hard-coded to load {{ic|background.png}} or {{ic|background.jpg}} (in that order) from your theme directory. Simply overwrite the appropriate file
 +
 
 +
# cp /path/to/new_background.jpg /usr/share/slim/themes/''<theme_name>''/background.jpg
 +
 
 +
==== Dual screen setup ====
 +
 
 +
You can customize the slim theme in {{ic|/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.
 +
 
 +
== Other options ==
 +
 
 +
=== Changing the cursor ===
 +
 
 +
After installing, edit {{ic|/etc/slim.conf}} and uncomment the line:
 +
 
 +
cursor  left_ptr
 +
 
 +
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]{{Dead link|2020|02|25}} or in {{ic|/usr/share/icons/<your-cursor-theme>/cursors/}}.
 +
 
 +
To change the cursor theme being used at the login screen, see [[Cursor themes#XDG specification]].
 +
 
 +
=== 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 {{ic|/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 {{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}}).
 +
 
 +
=== 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 {{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 ===
 +
 
 +
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 &
 +
 
 +
=== 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 {{ic|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 {{ic|/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 {{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).}}
 +
 
 +
See [[GNOME Keyring#Using the keyring outside GNOME]] 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 {{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
 +
 
 +
to
 +
 
 +
  xserver_arguments  -nolisten tcp vt07 -dpi 96
 +
 
 +
=== Use a random theme ===
 +
 
 +
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 ===
 +
 
 +
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
 +
 
 +
Simply change the vt07 to for example vt03 as no agetty is started there.
 +
 
 +
=== Automatically mount your encrypted /home on login ===
 +
 
 +
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
 +
 
 +
 
 +
=== Screen Lock ===
 +
 
 +
Slim includes slimlock, a screen lock feature. To use it, just run ''slimlock''.
 +
 
 +
Slimlock reads some configuration from ''/etc/slim.conf'' and its own configuration file ''/etc/slimlock.conf''.
 +
 
 +
To prevent VT switching whilst locked, set '''tty_lock''' to '''1''' in ''slimlock.conf''. This also requires that that you have write access to ''/dev/console'' and that slimlock has  the ''sys_sys_tty_config'' capability. One way to achieve this is set slimlock to suid root:
 +
 
 +
  chmod +4000 slimlock
 +
  chown root: slimlock
 +
 
 +
An alternative is to setcap and permit your uid to write to /dev/console.
 +
 
 +
  sudo setcap cap_sys_tty_config+ep /usr/bin/slimlock
 +
  sudo chmod o+rw /dev/console
 +
 
 +
You can use {{Pkg|xss-lock}} to lock the screen automatically:
 +
 
 +
  xss-lock -- /usr/bin/slimlock &
 +
 
 +
== All Slim Options ==
 +
 
 +
Here is a list of all the slim configuration options and their default values.
 +
 
 +
{{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'''}}
  
= Tips & Tricks =
+
{| class="wikitable collapsible collapsable collapsed"
==Slim and Desktop share a theme==
+
|-
A simple way of sharing wallpaper between Slim and your desktop is to create a symbolic link from your desktop wallpaper file to the default Slim theme:
+
! Option Name || Default Value
mv /usr/share/slim/themes/default/background.jpg /usr/share/slim/themes/default/background.old.jpg
+
|-
ln -s /path/to/mywallpaper.jpg /usr/share/slim/themes/default/background.jpg
+
| default_path ||{{ic|/bin:/usr/bin:/usr/local/bin}}
Now your Slim theme and desktop wallpaper will be the same, smoothing the transition while loading the desktop. (Obviously you must keep the default theme setting in /etc/slim.conf for the above trick to work.)
+
|-
 +
| default_xserver ||{{ic|/usr/bin/X}}
 +
|-
 +
| xserver_arguments ||{{ic|vt07 -auth /var/run/slim.auth}}
 +
|-
 +
| numlock ||
 +
|-
 +
| daemon || {{ic|yes}}
 +
|-
 +
| xauth_path ||{{ic|/usr/bin/xauth}}
 +
|-
 +
| login_cmd ||{{ic|exec /bin/bash -login ~/.xinitrc %session}}
 +
|-
 +
| halt_cmd ||{{ic|/sbin/shutdown -h now}}
 +
|-
 +
| reboot_cmd ||{{ic|/sbin/shutdown -r now}}
 +
|-
 +
| suspend_cmd ||
 +
|-
 +
| sessionstart_cmd ||
 +
|-
 +
| sessionstop_cmd ||
 +
|-
 +
| console_cmd ||{{ic|/usr/bin/xterm -C -fg white -bg black +sb -g %dx%d+%d+%d -fn %dx%d -T }}
 +
|-
 +
| screenshot_cmd ||{{ic|import -window root /slim.png}}
 +
|-
 +
| welcome_msg ||{{ic|Welcome to %host}}
 +
|-
 +
| session_msg ||{{ic|Session:}}
 +
|-
 +
| default_user ||
 +
|-
 +
| focus_password ||{{ic|no}}
 +
|-
 +
| auto_login ||{{ic|no}}
 +
|-
 +
| current_theme ||{{ic|default}}
 +
|-
 +
| lockfile ||{{ic|/var/run/slim.lock}}
 +
|-
 +
| logfile ||{{ic|/var/log/slim.log}}
 +
|-
 +
| authfile ||{{ic|/var/run/slim.auth}}
 +
|-
 +
| shutdown_msg ||{{ic|The system is halting...}}
 +
|-
 +
| reboot_msg ||{{ic|The system is rebooting...}}
 +
|-
 +
| sessiondir ||{{ic| /usr/share/xsessions/}}
 +
|-
 +
| hidecursor ||{{ic|false}}
 +
|-
 +
| input_panel_x ||{{ic|50%}}
 +
|-
 +
| input_panel_y ||{{ic|40%}}
 +
|-
 +
| input_name_x ||{{ic|200}}
 +
|-
 +
| input_name_y ||{{ic|154}}
 +
|-
 +
| input_pass_x ||{{ic|-1}}
 +
|-
 +
| input_pass_y ||{{ic|-1}}
 +
|-
 +
| input_font ||{{ic|1=Verdana:size=11}}
 +
|-
 +
| input_color ||{{ic|#000000}}
 +
|-
 +
| input_cursor_height ||{{ic|20}}
 +
|-
 +
| input_maxlength_name ||{{ic|20}}
 +
|-
 +
| input_maxlength_passwd ||{{ic|20}}
 +
|-
 +
| input_shadow_xoffset ||{{ic|0}}
 +
|-
 +
| input_shadow_yoffset ||{{ic|0}}
 +
|-
 +
| input_shadow_color ||{{ic|#FFFFFF}}
 +
|-
 +
| welcome_font ||{{ic|1=Verdana:size=14}}
 +
|-
 +
| welcome_color ||{{ic|#FFFFFF}}
 +
|-
 +
| welcome_x ||{{ic|-1}}
 +
|-
 +
| welcome_y ||{{ic|-1}}
 +
|-
 +
| welcome_shadow_xoffset ||{{ic|0}}
 +
|-
 +
| welcome_shadow_yoffset ||{{ic|0}}
 +
|-
 +
| welcome_shadow_color ||{{ic|#FFFFFF}}
 +
|-
 +
| intro_msg ||
 +
|-
 +
| intro_font ||{{ic|1=Verdana:size=14}}
 +
|-
 +
| intro_color ||{{ic|#FFFFFF}}
 +
|-
 +
| intro_x ||{{ic|-1}}
 +
|-
 +
| intro_y ||{{ic|-1}}
 +
|-
 +
| background_style ||{{ic|stretch}}
 +
|-
 +
| background_color ||{{ic|#CCCCCC}}
 +
|-
 +
| username_font ||{{ic|1=Verdana:size=12}}
 +
|-
 +
| username_color ||{{ic|#FFFFFF}}
 +
|-
 +
| username_x ||{{ic|-1}}
 +
|-
 +
| username_y ||{{ic|-1}}
 +
|-
 +
| username_msg ||{{ic|Please enter your username}}
 +
|-
 +
| username_shadow_xoffset ||{{ic|0}}
 +
|-
 +
| username_shadow_yoffset ||{{ic|0}}
 +
|-
 +
| username_shadow_color ||{{ic|#FFFFFF}}
 +
|-
 +
| password_x ||{{ic|-1}}
 +
|-
 +
| password_y ||{{ic|-1}}
 +
|-
 +
| password_msg ||{{ic|Please enter your password}}
 +
|-
 +
| msg_color ||{{ic|#FFFFFF}}
 +
|-
 +
| msg_font ||{{ic|1=Verdana:size=16:bold}}
 +
|-
 +
| msg_x ||{{ic|40}}
 +
|-
 +
| msg_y ||{{ic|40}}
 +
|-
 +
| msg_shadow_xoffset ||{{ic|0}}
 +
|-
 +
| msg_shadow_yoffset ||{{ic|0}}
 +
|-
 +
| msg_shadow_color ||{{ic|#FFFFFF}}
 +
|-
 +
| session_color ||{{ic|#FFFFFF}}
 +
|-
 +
| session_font ||{{ic|1=Verdana:size=16:bold}}
 +
|-
 +
| session_x ||{{ic|50%}}
 +
|-
 +
| session_y ||{{ic|90%}}
 +
|-
 +
| session_shadow_xoffset ||{{ic|0}}
 +
|-
 +
| session_shadow_yoffset ||{{ic|0}}
 +
|-
 +
| session_shadow_color ||{{ic|#FFFFFF}}
 +
|}
  
==Shutdown, Reboot, Suspend, Exit, Launch Terminal from SLiM==
+
==Troubleshooting==
You may shutdown, reboot, suspend, exit or even launch a terminal from the SLiM login screen.  To do so, enter the appropriate value 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 <tt>/etc/slim.conf</tt> to change terminal preference)
+
===Shutdown or Reboot Stalled===
  
*For shutdown, enter '''halt''' as the username
+
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.
  
*For reboot, enter '''reboot''' as the username
+
To accelerate the shutdown process these lines might help when added to /usr/lib/systemd/system/slim.service:
  
*To exit to bash, enter '''exit''' as the username
+
[Service]
 +
ExecStart=/usr/bin/slim -nodaemon
 +
Restart=on-failure
 +
TimeoutStopSec=5s
 +
IgnoreSIGPIPE=no
 +
ExecStop=/bin/kill -TERM -${MAINPID}
  
*For suspend, enter '''suspend''' as the username (Suspend is disabled by default, edit <tt>/etc/slim.conf</tt> as root to uncomment the <tt>suspend_cmd</tt> line and, if necessary modify the suspend command itself (e.g. change '''''/usr/sbin/suspend''''' to '''''sudo /usr/sbin/pm-suspend'''''))
+
See {{Bug|32380}}.
  
= Weblinks =
+
== See also ==
[http://slim.berlios.de/ SLiM homepage]
+
* [http://sourceforge.net/projects/slim.berlios/ SLiM on SourceForge]
 +
* [https://github.com/data-modul/slim SLiM on GitHub]

Latest revision as of 22:37, 25 February 2020

Warning: The SliM project has been abandoned (last release was 2013, the project homepage is down), 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.

SLiM can automatically detect installed desktop environments and window managers through the use of sessiondir /usr/share/xsessions/ in /etc/slim.conf. Those upgrading from a version before 1.3.6-2 must amend /etc/slim.conf and xinitrc, accordingly. See below.

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

You can preview a theme while Xorg is running with:

$ 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. See the theme documentation for how to customize your theme or make your own. SLiM does not support alternative theme directories, so it is recommended to create a package for your custom theme so that pacman is aware of it.

Custom background

SLiM is hard-coded to load background.png or background.jpg (in that order) from your theme directory. Simply overwrite the appropriate file

# cp /path/to/new_background.jpg /usr/share/slim/themes/<theme_name>/background.jpg

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.

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[dead link 2020-02-25] or in /usr/share/icons/<your-cursor-theme>/cursors/.

To change the cursor theme being used at the login screen, see Cursor themes#XDG specification.

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#Using the keyring outside GNOME 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


Screen Lock

Slim includes slimlock, a screen lock feature. To use it, just run slimlock.

Slimlock reads some configuration from /etc/slim.conf and its own configuration file /etc/slimlock.conf.

To prevent VT switching whilst locked, set tty_lock to 1 in slimlock.conf. This also requires that that you have write access to /dev/console and that slimlock has the sys_sys_tty_config capability. One way to achieve this is set slimlock to suid root:

 chmod +4000 slimlock
 chown root: slimlock

An alternative is to setcap and permit your uid to write to /dev/console.

 sudo setcap cap_sys_tty_config+ep /usr/bin/slimlock
 sudo chmod o+rw /dev/console

You can use xss-lock to lock the screen automatically:

 xss-lock -- /usr/bin/slimlock &

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