Blame SOURCES/Xclients

3c096a
#!/bin/bash
3c096a
# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
3c096a
# copyrighted material is made available to anyone wishing to use, modify,
3c096a
# copy, or redistribute it subject to the terms and conditions of the
3c096a
# GNU General Public License version 2.
3c096a
# 
3c096a
# You should have received a copy of the GNU General Public License
3c096a
# along with this program; if not, write to the Free Software
3c096a
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3c096a
3c096a
GSESSION="$(type -p gnome-session)"
3c096a
STARTKDE="$(type -p startkde)"
3c096a
3c096a
# check to see if the user has a preferred desktop
3c096a
PREFERRED=
3c096a
if [ -f /etc/sysconfig/desktop ]; then
3c096a
    . /etc/sysconfig/desktop
3c096a
    if [ "$DESKTOP" = "GNOME" ]; then
3c096a
	PREFERRED="$GSESSION"
3c096a
    elif [ "$DESKTOP" = "KDE" ]; then
3c096a
	PREFERRED="$STARTKDE"
3c096a
    fi
3c096a
fi
3c096a
3c096a
if [ -n "$PREFERRED" ]; then
3c096a
    exec "$PREFERRED"
3c096a
fi
3c096a
3c096a
# now if we can reach here, either no desktop file was present,
3c096a
# or the desktop requested is not installed.
3c096a
3c096a
if [ -n "$GSESSION" -a -f /usr/share/xsessions/gnome-classic.desktop ]; then
3c096a
    # by default, we run GNOME.
3c096a
    export GNOME_SHELL_SESSION_MODE=classic
3c096a
    exec "$GSESSION" --session=gnome-classic
3c096a
elif [ -n "$STARTKDE" ]; then
3c096a
    # if GNOME isn't installed, try KDE.
3c096a
    exec "$STARTKDE"
3c096a
fi
3c096a
3c096a
# We should also support /etc/X11/xinit/Xclients.d scripts
3c096a
XCLIENTS_D=/etc/X11/xinit/Xclients.d
3c096a
if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then
3c096a
    exec -l $SHELL -c "$SSH_AGENT $XCLIENTS_D/Xclients.$1.sh"
3c096a
fi
3c096a
3c096a
# Failsafe.
3c096a
3c096a
# these files are left sitting around by TheNextLevel.
3c096a
rm -f $HOME/Xrootenv.0
3c096a
3c096a
# Argh! Nothing good is installed. Fall back to twm
3c096a
{
3c096a
    # gosh, neither fvwm95 nor fvwm2 is available; 
3c096a
    # fall back to failsafe settings
3c096a
    [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
3c096a
3c096a
    if [ -x /usr/bin/xclock ] ; then
3c096a
	/usr/bin/xclock -geometry 100x100-5+5 &
3c096a
    fi
3c096a
    if [ -x /usr/bin/xterm ] ; then
3c096a
        /usr/bin/xterm -geometry 80x50-50+150 &
3c096a
    fi
3c096a
    if [ -x /usr/bin/firefox -a -f /usr/share/doc/HTML/index.html ]; then
3c096a
	/usr/bin/firefox /usr/share/doc/HTML/index.html &
3c096a
    fi
3c096a
    if [ -x /usr/bin/twm ] ; then
3c096a
	exec /usr/bin/twm
3c096a
    fi
3c096a
}