#!/bin/sh

# This gets run after ROX-Session is loaded and running as your session
# manager. ROX-Session will first try to load <Choices>/ROX-Session/Login,
# and only uses this if that is missing.
#
# This script should run any programs you want loaded when you log in and
# then exit. If you want to customise it, first copy it to
# ~/Choices/ROX-Session/Login and then edit that.

# Load a window manager. Keep trying until we find one that works!

wm=`which sawfish`
if [ ! -x "$wm" ]; then wm=`which sawmill`; fi
if [ ! -x "$wm" ]; then wm=`which enlightenment`; fi
if [ ! -x "$wm" ]; then wm=`which kwm`; fi
if [ ! -x "$wm" ]; then wm=`which fvwm2`; fi
if [ ! -x "$wm" ]; then wm=`which fvwm`; fi
if [ ! -x "$wm" ]; then wm=`which 4Dwm`; fi
if [ ! -x "$wm" ]; then wm=`which twm`; fi
$wm &

# Load ROX-Filer with a panel and a pinboard set up.

rox -p Default -b Default &

# Run any other stuff the user wants by searching all the
# Choices/ROX-Session/AutoStart directories...

if [ ! -n "$CHOICESPATH" ]; then
	CHOICESPATH=${HOME}/Choices:/usr/local/share/Choices:/usr/share/Choices
fi
IFS=":"
MYCHOICES=""
for DIR in $CHOICESPATH; do
  if [ -n "$DIR" ]; then
    AS="$DIR/ROX-Session/AutoStart"
    for PROG in $AS/*; do
      if [ -d "$PROG" ]; then
    	  $PROG/AppRun &
      elif [ -x "$PROG" ]; then
	$PROG &
      fi
    done
  fi
done
