#!/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.
#
# $1 is the ROX-Session application directory.

if [ ! -n "$CHOICESPATH" ]; then
	CHOICESPATH=${HOME}/Choices:/usr/local/share/Choices:/usr/share/Choices
fi
IFS=":"

# Load ROX-Filer with a panel and a pinboard set up.
MYCHOICES="(none)"
for DIR in $CHOICESPATH; do
  if [ "$MYCHOICES" = "(none)" ]; then
    MYCHOICES="$DIR"
  fi
  PANEL="$DIR/ROX-Filer/pan_Default"
  if [ -f "$PANEL" ]; then
    break;
  fi;
  PANEL="";
done

if [ -z "$PANEL" -a -n "$MYCHOICES" ]; then
  "$1/SetupPanel" "$1" "$MYCHOICES"
fi

rox -p Default -b Default &

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

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
