fixes to tomb-open calls of external programs

This commit is contained in:
Jaromil 2011-01-13 22:43:18 +01:00
parent dd71ddc57a
commit bee816111f

View File

@ -30,28 +30,32 @@ explore() {
fi fi
} }
try() {
which ${1} > /dev/null
if [ $? = 0 ]; then return 0;
else return -1; fi
}
# if no arguments are given, run in terminal # if no arguments are given, run in terminal
if [ -z $1 ]; then if [ -z $1 ]; then
explore gnome-terminal -e "tomb-open create" try gnome-terminal; if [ $? = 0 ]; then gnome-terminal -e "tomb-open create"; exit 0; fi
explore lxterm -bg black -fg white -e "tomb-open create" try lxterm; if [ $? = 0 ]; then lxterm -bg black -fg white -e "tomb-open create"; exit 0; fi
explore urxvt -bg black -fg white -e "tomb-open create" try urxvt; if [ $? = 0 ]; then urxvt -bg black -fg white -e "tomb-open create"; exit 0; fi
explore uxterm -bg black -fg white -e "tomb-open create" try uxterm; if [ $? = 0 ]; then uxterm -bg black -fg white -e "tomb-open create"; exit 0; fi
explore xterm -bg black -fg white -e "tomb-open create" try xterm; if [ $? = 0 ]; then xterm -bg black -fg white -e "tomb-open create"; exit 0; fi
exit 1
fi fi
# got a directory as argument # got a directory as argument
if [ -d $1 ]; then if [ -d $1 ]; then
# FIXME: somehow xdg-open loses mailcap mimes when executed by tomb-status # FIXME: somehow xdg-open loses mailcap mimes when executed by tomb-status
# explore xdg-open ${1} # try xdg-open; if [ $? = 0 ]; then xdg-open ${1}; exit 0; fi
try gnome-open; if [ $? = 0 ]; then gnome-open ${1}; exit 0; fi
# try known file managers try thunar; if [ $? = 0 ]; then thunar ${1}; exit 0; fi
explore gnome-open ${1} try rox; if [ $? = 0 ]; then rox ${1}; exit 0; fi
explore thunar ${1} try fsviewer; if [ $? = 0 ]; then fsviewer ${1}; exit 0; fi
explore rox ${1} try xnc; if [ $? = 0 ]; then xnc ${1}; exit 0; fi
explore fsviewer ${1}
explore xnc ${1}
tomb-notify "File manager not found." "Tomb cannot guess which filemanager you are using" tomb-notify "File manager not found." "Tomb cannot guess which filemanager you are using"
exit 1 exit 1
fi fi