#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
# (C)BABOLO xbundle V.M %%VERS%%  %%DATE%%
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Id: xinitrc,v 1.3 2003/05/15 01:45:11 babolo Exp $

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

if [ -f ${HOME}/.desk/predesk ]; then
    . ${HOME}/.desk/predesk
fi
if [ -r ${HOME}/.desk/wm ]; then
    exec `cat ${HOME}/.desk/wm`
elif [ ! -x /usr/X11R6/bin/fvwm95 ] && [ -x /usr/X11R6/bin/twm ]; then
    exec twm
elif [ -f ${HOME}/.desk/rc ] || [ -f /usr/contrib/desk/rc ]; then
    exec /usr/contrib/bin/wm_restart_fvwm95
else
    exec /usr/X11R6/bin/fvwm95
fi

