Skip to content

Instantly share code, notes, and snippets.

@masami256
Created February 11, 2012 12:41
Show Gist options
  • Save masami256/1799241 to your computer and use it in GitHub Desktop.
Save masami256/1799241 to your computer and use it in GitHub Desktop.
diff --git a/xdg-open b/xdg-open
index 02c06d7..74f77ab 100755
--- a/xdg-open
+++ b/xdg-open
@@ -610,7 +610,34 @@ open_lxde()
pcmanfm "$file"
else
- open_generic "$1"
+ # Lxde's default application setting will be in ~/.local/share/applications/mimeapps.list or
+ # ~/.config/libfm/prep-apps.conf, or /etc/xdg/libfm/prep-apps.conf.
+ # That setting has done by libfm-pref-apps command.
+ desktopfile=""
+ searchfile="$HOME/.local/share/applications/mimeapps.list"
+ if [ -e $searchfile ]; then
+ tmp=`grep "x-scheme-handler/http" $searchfile | grep -v ";"`
+ if [ x"$tmp" != "x" ]; then
+ desktopfile=`echo $tmp | cut -f2 -d'='`
+ fi
+ fi
+ if [ x"$desktopfile" = "x" ]; then
+ for searchfile in "$HOME/.config/libfm/pref-apps.conf" "/etc/xdg/libfm/pref-apps.conf"; do
+ if [ -e $searchfile ]; then
+ tmp=`grep Browser $searchfile`
+ if [ x"$tmp" != "x" ]; then
+ desktopfile=`echo $tmp | cut -f2 -d'=' | cut -f1 -d';'`
+ break
+ fi
+ fi
+ done
+ fi
+ browser=""
+ if [ x"$desktopfile" != "x" ]; then
+ browser=`desktop_file_to_binary $desktopfile`
+ fi
+
+ $browser $1
fi
if [ $? -eq 0 ]; then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment