1 diff -Nur xdg-utils-1.1.0-rc1.orig/scripts/xdg-email xdg-utils-1.1.0-rc1/scripts/xdg-email
2 --- xdg-utils-1.1.0-rc1.orig/scripts/xdg-email 2011-01-01 20:03:14.000000000 +1000
3 +++ xdg-utils-1.1.0-rc1/scripts/xdg-email 2011-03-06 20:18:04.886429689 +1000
9 +open_generic_browser()
12 for browser in $BROWSER; do
13 if [ x"$browser" != x"" ]; then
16 browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
17 - if [ $? -ne 0 ]; then browser_with_arg=$browser;
18 + if [ $? -ne 0 ]; then
19 + browser_with_arg=$browser;
22 - if [ x"$browser_with_arg" = x"$browser" ]; then "$browser" "$1";
23 - else $browser_with_arg;
24 + if [ x"$browser_with_arg" = x"$browser" ]; then
30 - if [ $? -eq 0 ]; then exit_success;
32 + if [ $? -eq 0 ]; then
38 exit_failure_operation_impossible "no method available for opening '$1'"
43 + if [ ! -z "$XDG_GENERIC_EMAIL" ]; then
44 + $XDG_GENERIC_EMAIL "$1"
46 + if [ $? -eq 0 ]; then
49 + exit_failure_operation_failed
52 + open_generic_browser $@
58 result=$(echo "$1" | $utf8 | awk '
63 +# check system config
64 +if [ ! -z "$XDG_CONFIG_DIRS" ]; then
66 + for dir in $XDG_CONFIG_DIRS
68 + cfg="$dir/xdg-utils/xdg-utils.rc"
69 + if [ -e "$cfg" ]; then
76 +if [ ! -z "$XDG_CONFIG_HOME" ]; then
77 + cfg="$XDG_CONFIG_HOME/xdg-utils/xdg-utils.rc"
78 + if [ -e "$cfg" ]; then
82 +# Update BROWSER variable, based on config file
83 +if [ ! -z "$XDG_GENERIC_BROWSER" ]; then
84 + BROWSER="$XDG_GENERIC_BROWSER:$BROWSER"
90 diff -Nur xdg-utils-1.1.0-rc1.orig/scripts/xdg-mime xdg-utils-1.1.0-rc1/scripts/xdg-mime
91 --- xdg-utils-1.1.0-rc1.orig/scripts/xdg-mime 2011-01-01 20:03:14.000000000 +1000
92 +++ xdg-utils-1.1.0-rc1/scripts/xdg-mime 2011-03-06 20:53:59.947273327 +1000
97 -xdg-mime query { filetype | default } ...
98 +xdg-mime query { filetype | default[ --command] } ...
99 + filetype -- detect MIME type of file
100 + default -- print default handler for MIME
101 + with option --command - print binary command instead
104 xdg-mime default application mimetype(s)
107 mv ${default_file}.new $default_file
110 +# This handles backslashes but not quote marks.
117 +desktop_file_to_binary()
119 + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
120 + desktop="`basename "$1"`"
122 + for dir in $search; do
124 + [ "$dir" -a -d "$dir/applications" ] || continue
125 + file="$dir/applications/$desktop"
126 + [ -r "$file" ] || continue
127 + # Remove any arguments (%F, %f, %U, %u, etc.).
128 + command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"
129 + command="`which "$command"`"
130 + readlink -f "$command"
139 xdg_user_dir="$XDG_DATA_HOME"
140 [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
141 xdg_user_dir="$xdg_user_dir/$xdg_dir_name"
143 DEBUG 2 "Checking $x/applications/defaults.list"
144 trader_result=`grep "$MIME=" $x/applications/defaults.list 2> /dev/null | cut -d '=' -f 2 | cut -d ';' -f 1`
145 if [ -n "$trader_result" ] ; then
146 - echo $trader_result
148 + if [ "$ARG" == "--command" ]; then
149 + desktop_file_to_binary "$trader_result"
151 + echo $trader_result
162 if [ -z "$mimetype" ] ; then
163 exit_failure_syntax "mimetype argument missing"
169 - defapp_generic "$mimetype"
170 + defapp_generic "$mimetype" "$mimetype_arg"
173 exit_failure_operation_impossible "no method available for quering default application for '$mimetype'"
174 diff -Nur xdg-utils-1.1.0-rc1.orig/scripts/xdg-open xdg-utils-1.1.0-rc1/scripts/xdg-open
175 --- xdg-utils-1.1.0-rc1.orig/scripts/xdg-open 2011-01-01 20:03:14.000000000 +1000
176 +++ xdg-utils-1.1.0-rc1/scripts/xdg-open 2011-03-06 20:27:54.136450426 +1000
179 #---------------------------------------------
191 +open_generic_browser()
194 + for browser in $BROWSER; do
195 + if [ x"$browser" != x"" ]; then
197 + browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
198 + if [ $? -ne 0 ]; then
199 + browser_with_arg=$browser;
202 + if [ x"$browser_with_arg" = x"$browser" ]; then
204 + else eval '$browser_with_arg'$xdg_redirect_output;
207 + if [ $? -eq 0 ]; then
216 + if [ ! -z "$XDG_GENERIC_OPEN" ]; then
217 + $XDG_GENERIC_OPEN "$1"
218 + if [ $? -eq 0 ]; then
223 # Paths or file:// URLs
224 if (echo "$1" | grep -q '^file://' ||
225 ! echo "$1" | egrep -q '^[a-zA-Z+\.\-]+:'); then
231 - for browser in $BROWSER; do
232 - if [ x"$browser" != x"" ]; then
234 - browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
235 - if [ $? -ne 0 ]; then
236 - browser_with_arg=$browser;
239 - if [ x"$browser_with_arg" = x"$browser" ]; then
241 - else eval '$browser_with_arg'$xdg_redirect_output;
244 - if [ $? -eq 0 ]; then
249 + open_generic_browser "$1"
251 exit_failure_operation_impossible "no method available for opening '$1'"
254 exit_failure_syntax "file or URL argument missing"
257 +if which xdg-open-hook.sh > /dev/null 2> /dev/null; then
258 + xdg-email-hook.sh "${mailto}"
259 + if [ $? -eq 0 ]; then
262 + exit_failure_operation_failed
268 if [ x"$DE" = x"" ]; then
273 +# check system config
274 +if [ ! -z "$XDG_CONFIG_DIRS" ]; then
276 + for dir in $XDG_CONFIG_DIRS
278 + cfg="$dir/xdg-utils/xdg-utils.rc"
279 + if [ -e "$cfg" ]; then
285 +# check users config
286 +if [ ! -z "$XDG_CONFIG_HOME" ]; then
287 + cfg="$XDG_CONFIG_HOME/xdg-utils/xdg-utils.rc"
288 + if [ -e "$cfg" ]; then
292 +# Update BROWSER variable, based on config file
293 +if [ ! -z "$XDG_GENERIC_BROWSER" ]; then
294 + BROWSER="$XDG_GENERIC_BROWSER:$BROWSER"
300 diff -Nur xdg-utils-1.1.0-rc1.orig/scripts/xdg-settings xdg-utils-1.1.0-rc1/scripts/xdg-settings
301 --- xdg-utils-1.1.0-rc1.orig/scripts/xdg-settings 2011-01-01 20:03:14.000000000 +1000
302 +++ xdg-utils-1.1.0-rc1/scripts/xdg-settings 2011-03-06 20:35:22.903937128 +1000
307 +if [ x"$DE" = x"" ]; then
311 +# check system config
312 +if [ ! -z "$XDG_CONFIG_DIRS" ]; then
314 + for dir in $XDG_CONFIG_DIRS
316 + cfg="$dir/xdg-utils/xdg-utils.rc"
317 + if [ -e "$cfg" ]; then
323 +# check users config
324 +if [ ! -z "$XDG_CONFIG_HOME" ]; then
325 + cfg="$XDG_CONFIG_HOME/xdg-utils/xdg-utils.rc"
326 + if [ -e "$cfg" ]; then
330 +# Update BROWSER variable, based on config file
331 +# TODO: do more clean
332 +if [ ! -z "$XDG_GENERIC_BROWSER" ]; then
333 + BROWSER="$XDG_GENERIC_BROWSER"
338 dispatch_specific "$@"