#!/bin/sh
#
# Very simple session manager for matchbox tools
#

echo "0" >/proc/power_key_off 2>/dev/null

test -f /etc/profile && . /etc/profile

# Uncomment below to enable parsing of debian menu entrys
# export MB_USE_DEB_MENUS=1 


if [ ! -d $HOME/Choices/common ]; then
    mkdir -p $HOME/Choices/common
fi

if [ -f $HOME/Choices/lightnpower.cfg ]; then
    lightnpower.py --loadandquit
fi

if [ -f /usr/bin/gconfd-2 ]; then
    /usr/bin/gconfd-2 15 &
fi

MODEL=`cat /proc/deviceinfo/product`
echo 'MODEL:'$MODEL
case "$MODEL" in
    SL-C860|SL-C760) 
	test -f /etc/X11/kb/corgi.xmodmap && xmodmap /etc/X11/kb/corgi.xmodmap
	;;
    SL-6000)
	test -f /etc/X11/kb/tosa.xmodmap && xmodmap /etc/X11/kb/tosa.xmodmap
	;;
    SL-C1000|SL-C3000|SL-C3100|SL-C3200)
        test -f /etc/X11/kb/akita.xmodmap && xmodmap /etc/X11/kb/akita.xmodmap
        ;; 
    *)
	cat /proc/cpuinfo | grep 'Sharp-Collie' 2>/dev/null >/dev/null && test -f /etc/X11/kb/collie.xmodmap && xmodmap /etc/X11/kb/collie.xmodmap
	;;
esac

test -f /etc/X11/kb/userdefined.xmodmap && xmodmap /etc/X11/kb/userdefined.xmodmap
test -f /usr/bin/chkhinge && /usr/bin/chkhinge 2>/dev/null >/dev/null


/usr/X11R6/bin/xset s 0

xrandr -o right

xfce4-session

GCONF2_PID=`pidof gconfd-2`
if [ ! "$GCONF2_PID" = "" ]; then
    kill $GCONF2_PID
fi

echo "1" >/proc/power_key_off 2>/dev/null
