KDM ハンドブック
前のページ | 第 3章Configuring your system to use KDM | 次のページ

# 3.2. Supporting multiple window managers

The main dialogue box for KDM includes a "session type" drop-down box, which allows you to select a window manager to use for your session. This chapter describes the changes that you must make to your configuration files in order to support this feature.

The options that appear in the "session type" drop-down box are configured by entries in the `KDM` section of `kdmrc`.

When you log in using KDM, the shell script `Xsession` is executed. The session type that you select is passed as a command-line argument. (`Xsession` can be found in `/etc/X11/xdm/` for Redhat and Mandrake, and in `/usr/X11R6/lib/X11/xdm/` for S.u.S.E.). Whilst debugging, you might find it helpful to add this line to `Xsession`:

     echo "$0 || $1 || $2" > $HOME/.Xsession_args

How you proceed now depends upon how your system usually starts up window managers. Here are two different approaches, with examples of the changes that you must make:

- The window manager is started by commands within `Xsession`. In this case, you can add a case statement to start the appropriate window manager. Linux Mandrake uses this approach; here is an extract from `Xsession`:

       # now, we see if xdm/gdm/kdm has asked for a specific environment
       case $# in
       1)
           case $1 in
               kde)
               source /opt/kde2/bin/kde1
               exec startkde
               ;;
               kde2)
               source /opt/kde2/bin/kde2
               exec startkde
               ;;
           	failsafe)
       	exec xterm -geometry 80x24-0-0
       	;;
       	default)
       	;;
       	*)
       	exec /bin/sh -c "$(/usr/sbin/chksession -x=$1)"
       	;;
            esac
       esac

- The window manager is started by another script that is invoked by `Xsession`. In this case you must ensure that the parameter passed to `Xsession` is passed on to that other script. For example, if the window manager is started like this:

       exec $startup

  you would need to change it to:

       exec $startup $@

  Having made this change, you must trace your way through the startup to find the place where the window manager is started. One approach uses `xinitrc` to start the window manager; this allows a system-wide file `/etc/X11/xinit/xinitrc` or a user-specific file `$HOME/.xinitrc` to be used. If you edit `$HOME/.xinitrc`, you may want to save a copy in `/etc/skel`, so that it will be automatically generated in every user account you create from now on. Here is an example `xinitrc` for a system using this approach:

       #!/bin/bash
       #
       # .xsession/.xinitrc
       #
       # choose a window manager
       #

       defaultwm=kde
       #set the window manager to $1 if it was supplied
       windowmgr=${1:-$defaultwm}

       #start the respective window managers
       case ${windowmgr} in
         kde|kwm|kdestart)
       	WINDOWMANAGER=startkde
       	;;
         fvwm|fvwm2)
       	WINDOWMANAGER=fvwm2
       	;;

         fvwm95)
       	WINDOWMANAGER=fvwm95
       	;;

         *)    WINDOWMANAGER=windowmgr   # default for unknown wm's

       esac

       #
       # load resources
       #

       if [ -f /usr/X11R6/lib/X11/Xmodmap ]; then
           xmodmap /usr/X11R6/lib/X11/Xmodmap
       fi

       if [ -f ~/.Xmodmap ]; then
           xmodmap ~/.Xmodmap
       fi

       if [ -f ~/.Xdefaults ]; then
           xrdb -merge ~/.Xdefaults
       fi

       if [ -f ~/.Xresources ]; then
           xrdb -merge ~/.Xresources
       fi
       #
       # finally start the window manager
       #
       exec $WINDOWMANAGER

前のページ | Home | 次のページ
Configuring your system to use KDM | Up | Building and Installing kdm