# 2.2. Different window managers with kdm (chooser)

If you have to use different window managers or you just want to try others from time to time you can take advantage of the chooser built into kdm. The chooser lets you choose a window manager of a predefined list. This again needs some changes in configuration files. First you have to change your `Xsession`-file (path is `/etc/X11/xdm/` for Redhat and `/usr/X11R6/lib/X11/xdm/` for S.u.S.E.) to pass parameters. To do so look at the lines `'exec $startup'` and change it to `'exec $startup " $@"'` (without ') After this you have to create/edit your /etc/xinitrc or /.xinitrc file to react on the different window managers. The following script has three different windowmanagers to start. You can add more stuff if you like. Don't forget to save a copy of your `.xinitrc` file to `/etc/skel`, so it will be automatically generated for every user you create from now on.

     #!/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