Gentoo Wiki




SLiM (mindlock theme)
SLiM (mindlock theme)

SLiM - Simple Login Manager - is a desktop-independent graphical login manager for X11. It offers enough functionality to be considered a viable alternative to XDM. As it does not depend on KDE or GNOME libraries, it is well-suited for use with light-weight desktop environments like Xfce or Fluxbox.


echo "x11-misc/slim ~x86" >> /etc/portage/package.keywords
emerge -av slim

If you want another theme, you should also install slim-themes:

echo "x11-themes/slim-themes ~x86" >> /etc/portage/package.keywords
emerge -av slim-themes

Post-installation configuration

Start SLiM automatically

If you wish SLiM to start automatically, you'll have to edit /etc/conf.d/xdm and add xdm to your runlevel.

Set SLiM as display manager in /etc/conf.d/xdm:

File: /etc/conf.d/xdm

Add xdm to your default runlevel: rc-update add xdm default

Window manager

By default, SLiM will use default XSESSION value set in /etc/rc.conf.

Set your desired window manager. Valid options are for example "fluxbox", "kde", "gnome", "wmii", "xfce4":

File: /etc/rc.conf

Edit the .xinitrc in your $HOME directory to start your window manager of choice. If you do not use Fluxbox, this line will be different (e.g. "exec startkde" for KDE and "exec pekwm" for PekWM). Also examine SLiM's xinitrc.sample and "man xinit" as they might be of some use.

echo "exec startfluxbox" > ~/.xinitrc

Change theme

You can find all installed themes in /usr/share/slim/themes. To preview a theme, run:

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

Specify the theme in the SLiM configuration file:

File: /etc/slim.conf
Find the line,
 current_theme       default
Replace default with your preferred theme name.


Select different sessions with SLiM

Variant A

First become root on you box so you can edit the needed files:

su -

Now go to /etc/X11/xinit/

cd /etc/X11/xinit/

and create a new script called slim_xinitrc_wrapper with your prefered editor, eg:

nano slim_xinitrc_wrapper
File: /etc/X11/xinit/slim_xinitrc_wrapper
export XSESSION=$1

Now make this script executable:

chmod a+x slim_xinitrc_wrapper

This slim wrapper script just feeds it's first parameter into the XSESSION variable which then gets evaluated by the standard gentoo xinitrc mechanisms. To make this work you have to launch the slim wrapper script instead of the xinitrc. This is configured in the slim.conf:

nano /etc/slim.conf
File: /etc/slim.conf
# Command run on login
login_cmd       exec /bin/bash -login /etc/X11/xinit/slim_xinitrc_wrapper %session
# Specify sessions here
sessions            fluxbox,freevo

Note that the xinitrc script expects a script in /etc/X11/Session with the name of the selected session. Note also that the %session variable of SLiM is empty if you don't press F1 to choose a session. This leads to evaluation of the XSESSION variable in /etc/rc.conf. You can (should?) set your default session there:

nano /etc/rc.conf
File: /etc/rc.conf
# XSESSION is a new variable to control what window manager to start

Variant B

First we edit our slim.conf file to set which sessions we want to choose from.

nano /etc/slim.conf
File: /etc/slim.conf
# Command run on login
login_cmd       exec /bin/bash - ~/.xinitrc %session
# Specify sessions here
sessions            GNOME,KDE,XFCE4,ICEWM,FLUXBOX

Next we edit our users .xinitrc to match with the variables listed in slim.conf and execute the proper session.

nano ~/.xinitrc
File: ~/.xinitrc
case "$1" in
                exec gnome-session
                exec startkde
                exec startxfce4
                exec icewm-session
                exec startfluxbox
                exec $DEFAULTSESSION

Once SLiM loads simply hit F1 to cycle between sessions. Not hitting F1 will execute the DEFAULTSESSION.

Starting Xfce4

If you find that your Xfce session isn't saved upon logout using the startxfce4 command, change your ~/.xinitrc a bit

File: ~/.xinitrc
#exec startxfce4
exec xfce4-session

Trouble with Xfce4

If you are having trouble getting SLiM to load with non-root accounts try adding this to your slim.conf

File: /etc/slim.conf
login_cmd   exec /bin/bash -login /etc/X11/xinit/xinitrc

See also

Retrieved from ""

Last modified: Thu, 25 Sep 2008 23:20:00 +0000 Hits: 15,856