export OOO_FORCE_DESKTOP=gnome
if ! echo "$PATH" | grep -q 'ian'; then
    export PATH="$HOME/bin:$PATH"
fi

xsetroot -solid black -cursor_name top_left_arrow

run_daemon () {
    pidof "$1" && killall "$1" && sleep 3
    (exec "[email protected]") &
}

# xfce4-panel &

run_daemon nm-applet
run_daemon gnome-settings-daemon 
run_daemon gnome-power-manager
run_daemon update-notifier
run_daemon thunar --daemon
/home/ian/bin/dbcli.py status > /dev/null &

if [ `hostname` != "ian-laptop" ]; then
    run_daemon pidgin
fi
pgrep checkgmail && killall checkgmail && sleep 3
(sleep 10; checkgmail) &

run_daemon klipper

run_daemon remind -z '-knotify-send -t 5000 Remind %s' ~/.rem

if [ -z "$MY_WM" ]; then
    MY_WM=xmonad
fi

case "$MY_WM" in
xmonad)
    /home/ian/bin/trayer.sh &
    exec xmonad
;;
openbox)
    exec gnome-session
;;
*)
    exec "$MY_WM"
;;
esac