#!/bin/sh

# $Progeny: xinitrc,v 1.7 2002/04/23 22:19:03 branden Exp $

/usr/bin/X11/xsetroot -cursor_name watch

if /usr/bin/X11/xsetroot -solid darkslateblue; then
    echo "Set root window to solid darkslateblue." >&2
else
    echo "Can't set the root window to a solid color!  What's going on?" >&2
fi

# XXX: pretty kludgey...
BITMAP=/etc/configlets/root_window.xbm
FALLBACK=yes
DEPTH=$(/usr/bin/X11/xdpyinfo | /bin/grep 'depth of root window' | /usr/bin/cut -d: -f2 | /bin/sed -e 's/ //g' -e 's/planes//')
if [ -n "$DEPTH" ]; then
    if [ $DEPTH -gt 4 ]; then
        IMAGEFILE=$(/bin/ls /etc/configlets/root_window.* | /bin/grep -v '\.xbm$' | /usr/bin/head -1)
        if [ -n "$IMAGEFILE" ]; then
            if /usr/bin/xsetbg $IMAGEFILE; then
                echo "Using $IMAGEFILE as root window." >&2
                FALLBACK=
            fi
        fi
    fi
fi

if [ -n "$FALLBACK" ]; then
    if [ -e $BITMAP ]; then
        if /usr/bin/X11xsetroot -bitmap $BITMAP; then
            echo "Using $BITMAP as root window." >&2
        fi
    fi
fi

/usr/bin/fvwm2 -f /etc/configlets/fvwm2rc &

/usr/bin/X11/xsetroot -cursor_name left_ptr

/usr/sbin/configlets-druid

if /usr/bin/do-apt-cdrom; then
    if [ -x /usr/bin/gnome-tasksel ]; then
        /usr/bin/gnome-tasksel
    fi
fi

# vim:ai:et:sts=4:sw=4:tw=0:
