diff --git a/scripts/xdg-open b/scripts/xdg-open index fee4204..b9ed3a1 100755 --- a/scripts/xdg-open +++ b/scripts/xdg-open @@ -386,25 +386,31 @@ open_xfce() open_generic_xdg_mime() { filetype=`xdg-mime query filetype "$1" | sed "s/;.*//"` - default=`xdg-mime query default "$filetype"` - if [ -n "$default" ] ; then + defaults=`xdg-mime query default "$filetype"` + if [ -n "$defaults" ] ; then xdg_user_dir="$XDG_DATA_HOME" [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" xdg_system_dirs="$XDG_DATA_DIRS" [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/ - for x in `echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`; do - local file="$x/applications/$default" - if [ -r "$file" ] ; then - command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" - command_exec=`which $command 2>/dev/null` - if [ -x "$command_exec" ] ; then - $command_exec "$1" - if [ $? -eq 0 ]; then - exit_success + IFS=";" + for default in $defaults; do + if [ x"$default" != x"" ]; then + unset IFS + for x in `echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`; do + local file="$x/applications/$default" + if [ -r "$file" ] ; then + command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" + command_exec=`which $command 2>/dev/null` + if [ -x "$command_exec" ] ; then + $command_exec "$1" + if [ $? -eq 0 ]; then + exit_success + fi + fi fi - fi + done fi done fi