Gregor Diseth wrote:

> By default, when a user logs in, it presents them with the default grey
> desktop and an xterm, with twm as the window manager.
> 
> For now, all I would like it do is 'pick up' the user's .xinitrc and give
> them their desktop, as if they had run xinit from the shell.

Xdm looks for .xsession.  If the use renames .xinitrc to .xsession, it
will work the way you want it to.  If you don't want to make your
users set up the symlink, you should be able to put some code in
/etc/X11/xinit/Xclients to look for the .xinitrc file.  Something
like what you see at the bottom of /usr/lib/X11/xdm/Xsession:

        if [ -x "$HOME/.xsession" ]; then
            exec "$HOME/.xsession"

My box has a long and complicated Xclients file with a Red Hat copyright.
I assume that's not on your FreeBSD box. (-:

For reference, I've attached the /usr/lib/X11/xdm/Xsession file
from my machine.  I don't think Mandrake modified it, since they
replace the thing wholesale with kdm, but I'm not sure.

-- 
Bob Miller                              K<bob>
kbobsoft software consulting
http://kbobsoft.com                     [EMAIL PROTECTED]
#!/bin/bash -login
# (c) 1999 Red Hat Software, Inc.
# Modification for Linux-Mandrake by Chmouel Boudjnah <[EMAIL PROTECTED]>

xsetroot -solid \#356390

# redirect errors to a file in user's home directory if we can
for errfile in "$HOME/.xsession-errors" "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
do
    if ( cp /dev/null "$errfile" 2> /dev/null )
    then
        chmod 600 "$errfile"
        exec > "$errfile" 2>&1
        break
    fi
done

# clean up after xbanner
if [ -f /usr/X11R6/bin/freetemp ]; then
    freetemp
fi

userresources=$HOME/.Xresources 
usermodmap=$HOME/.Xmodmap 
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources 
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap 

# merge in defaults and keymaps 
if [ -f $sysresources ]; then 
    xrdb -merge $sysresources 
fi 
 
if [ -f $sysmodmap ]; then 
    xmodmap $sysmodmap 
fi 
 
if [ -f $userresources ]; then 
    xrdb -merge $userresources 
fi 
 
if [ -f $usermodmap ]; then 
    xmodmap $usermodmap 
fi 

# now, we see if xdm/gdm/kdm has asked for a specific environment
case $# in
1)
    case $1 in
        kde)
        exec startkde
        ;;
        kde2)
        exec /opt/kde2/bin/kde2env /opt/kde2/bin/startkde
        ;;
        gnome)
        exec gnome-session
        ;;
        anotherlevel)
    # we assume that switchdesk is installed.
        exec /usr/share/apps/switchdesk/Xclients.anotherlevel
        ;;
        WindowMaker)
        [ -f $HOME/GNUstep/Defaults/WindowMaker ] || {
                /usr/X11R6/bin/wmaker.inst --batch
        }
        exec /usr/X11R6/bin/wmaker
        ;;      
        AfterStep)
        exec /usr/X11R6/bin/afterstep
        ;;
        Icewm)
        exec /usr/X11R6/bin/icewm
        ;;
        Xfce)
        for i in $(ls $HOME/Desktop/Autostart/); do
            if test -x $HOME/Desktop/Autostart/$i; then
                $HOME/Desktop/Autostart/$i &
            fi
        done
        exec xfwm
        ;;
        failsafe)
        exec xterm -geometry 80x24-0-0
        ;;
    esac
esac

# otherwise, take default action
if [ -x "$HOME/.xsession" ]; then
    exec "$HOME/.xsession"
elif [ -x "$HOME/.Xclients" ]; then
    exec "$HOME/.Xclients"
elif [ -x /etc/X11/xinit/Xclients ]; then
    exec /etc/X11/xinit/Xclients
else
    exec xsm
fi

Reply via email to