Solving xdg-open special URI opening problems
Hi
Is there any clear (not dirty-hack style) way to make xdg-open open URIs like 'magnet:...' and so on? I've created workaround (see the patch), but maybe there is better way?
Thank you
--- /usr/bin/xdg-open.orig 2013-03-02 16:02:36.184184989 +0400 +++ /usr/bin/xdg-open 2013-03-02 16:51:53.878851407 +0400 @@ -384,7 +384,11 @@ open_generic_xdg_mime() { - filetype=`xdg-mime query filetype "$1" | sed "s/;.*//"` + if [ -z $not_file ]; then + filetype=`xdg-mime query filetype "$1" | sed "s/;.*//"` + else + filetype=x-scheme-handler/`echo "$1" | cut -d: -f 1` + fi default=`xdg-mime query default "$filetype"` if [ -n "$default" ] ; then xdg_user_dir="$XDG_DATA_HOME" @@ -444,6 +448,9 @@ exit_success fi fi + elif (echo "$1" | egrep -q '^[a-zA-Z+\.\-]+:'); then + not_file=1 + open_generic_xdg_mime "$1" fi OLDIFS="$IFS"
UPDATE: Script for adding support for all your current x-scheme-handler types http:// pastebin.com/qkVbkrqq . Still looking for better solution
add a comment