Next Previous Contents

3. Adding new window manager selections to the drop-down list

WARNING: The procedures explained in this HOWTO involve making changes to system configuration files; if you are not experienced in making such changes, some caution is required. Introducing errors into such files may make your system unstable, or cause it to crash. The procedures explained in this HOWTO have been tested and should not cause problems if used correctly.

If you have KDE 2.2 or higher, and you are not comfortable with manual editing of system files, you may open a terminal window (xterm or konsole) from your user desktop (NOT the root desktop), then type and enter:


su -c 'kcontrol'

Enter your root password at the prompt, and make the changes from within the KDE Control Center that appears: go to Applications ==> Login Manager. Choose the appropriate configuration tab; you can easily configure every aspect of the login screen from there. In Earlier versions of KDE, kcontrol can modify kdmrc, but cannot modify Xsession which is used in those versions; see the note below about changes from KDE 2.2 and higher.

To see how to manually configure some of these, and see what these configuration files do, proceed as follows:

(Caution: Some configuration files have changed since the version of kdm I'm using, particularly since KDE > 2.0:

The following is quoted from the FreeBSD Handbook-X11:

"Note: In KDE 2.2 this has changed: kdm now uses its own configuration files. Please see the KDE 2.2 documentation for details.")

Note: KDE 3.1 has added kdm documentation, see The kdm Handbook

Much of the material in this new handbook applies to the older versions; new features are also described therein.

Check the documentation for your version to identify the current configuration files if you want to manually edit these, or just want to see how they work.

Do not use a word-processor program for editing system configuration files; such programs introduce special formatting characters which will corrupt the files. Use a text-editor, particularly one which can handle long lines without introducing extra carriage-return or line feed characters into existing code. Suitable editors include vim (vi improved), vi, and emacs. There are others, but these are usually installed by default in Linux workstation installations; they each have features which make them especially suitable for writing and editing computer code. See the bibliography section at the end of this HOWTO for more information.

IMPORTANT: Before making changes to any system configuration files, you should make back-up copies of the originals, so you can restore them in case of serious errors!

The files which we will be changing here are /usr/share/config/kdmrc, which is where we add selection labels to the drop-down list on the login screen, and /etc/X11/xdm/Xsession, which is where we add the path to the executables for our labels (if you are using a different distribution, the path to these files may be different; just do "locate kdmrc" and "locate Xsession" in the shell [i.e., in a terminal emulation, such as xterm, or KDE's konsole] to find them).

The default line to change in kdmrc looks like this:


SessionTypes=kde;gnome;anotherlevel;default;failsafe; 

After adding selection labels for two new window managers, windowmaker and blackbox, the line looks like this:


SessionTypes=kde;gnome;windowmaker;blackbox;anotherlevel;default;failsafe; 

Notice the positions where I have added the labels for the new window managers; all entries will appear on the drop-down list in the same order as they appear in the SessionTypes list. Next, the actual choosing takes place in /etc/X11/xdm/Xsession. Here is what the appropriate section of Xsession looks like before adding the new entries:


# now, we see if xdm/gdm/kdm has asked for a specific environment
#
case $# in
1)
    case $1 in
    failsafe)
        exec xterm -geometry 80x24-0-0
        ;;
    gnome)
        exec gnome-session
        ;;
    kde)
        exec startkde
        ;;   
    anotherlevel)
        # we assume that switchdesk is installed.
        exec /usr/share/apps/switchdesk/Xclients.anotherlevel
        ;;
    esac
esac  

Here is what this section of the Xsession file looks like after adding the new entries (NOTE that the selection labels must be exactly the same in Xsession and prefdm, i.e., spelling and case must be identical):


# now, we see if xdm/gdm/kdm has asked for a specific environment
#
case $# in
1)
    case $1 in
    failsafe)
        exec xterm -geometry 80x24-0-0
        ;;
    gnome)
        exec gnome-session
        ;;
    kde)
        exec startkde
        ;;
    windowmaker)        
        exec wmaker
        ;;
    blackbox)        
        exec blackbox
        ;;    
    anotherlevel)
        # we assume that switchdesk is installed.
        exec /usr/share/apps/switchdesk/Xclients.anotherlevel
        ;;
    esac
esac  

Note that when the executables are installed in one of the paths shown below, only the executable name is required after "exec"; otherwise the full path must be included, as shown for "Xclients.anotherlevel" (above):

/usr/bin/

/usr/local/bin/

/usr/X11R6/bin/

/usr/bin/X11/

These examples should be enough for you to add your favorite window manager(s) to the KDE graphical login, or to give you a starting point to find out how it's done in your particular installation.


Next Previous Contents