#!/bin/bash

if [ -z $DISPLAY ]
then
	DIALOG=dialog
else
	DIALOG=Xdialog
fi

tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15

$DIALOG --clear --title "Mode Menu" \
        --menu "Choose the mode that you want to enter:" 20 51 4 \
		"modes/home" "Home" \
		"modes/work" "Work" \
		"modes/kris_home" "Kris' House" 2> $tempfile

retval=$?

choice=`cat $tempfile`

case $retval in
  0)
    $choice;;
  1)
    echo "Cancel pressed.";;
  255)
    echo "ESC pressed.";;
esac
