#!/bin/sh
# Wrapper for xdg-open, to open files from linux menu shortcuts.

if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
fi


# If no desktop is detected, prefer our xdg-open to the system version -- we'll generally
# do a better job in this case
if [ x"$DE" = x"" ]; then
    export PATH=`dirname $0`:$PATH
# If we can detect the desktop, prefer the system xdg-open if it exists
else
    export PATH=$PATH:`dirname $0`
fi

xdg-open $*
