updated on Thu Jan 12 08:01:00 UTC 2012
[aur-mirror.git] / xdg-utils-ng / hatred-xdg-utils-ng-1.1.0rc1.diff
blobd7f85e6a369dab97e3162ca2cc26900a8e980e0f
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
4 @@ -509,21 +509,25 @@
5 fi
8 -open_generic()
9 +open_generic_browser()
11 IFS=":"
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
25 + "$browser" "$1";
26 + else
27 + $browser_with_arg;
30 - if [ $? -eq 0 ]; then exit_success;
32 + if [ $? -eq 0 ]; then
33 + exit_success;
36 done
37 @@ -531,6 +535,21 @@
38 exit_failure_operation_impossible "no method available for opening '$1'"
41 +open_generic()
43 + if [ ! -z "$XDG_GENERIC_EMAIL" ]; then
44 + $XDG_GENERIC_EMAIL "$1"
46 + if [ $? -eq 0 ]; then
47 + exit_success
48 + else
49 + exit_failure_operation_failed
50 + fi
51 + else
52 + open_generic_browser $@
53 + fi
56 url_encode()
58 result=$(echo "$1" | $utf8 | awk '
59 @@ -703,6 +722,30 @@
63 +# check system config
64 +if [ ! -z "$XDG_CONFIG_DIRS" ]; then
65 + IFS=":"
66 + for dir in $XDG_CONFIG_DIRS
67 + do
68 + cfg="$dir/xdg-utils/xdg-utils.rc"
69 + if [ -e "$cfg" ]; then
70 + source "$cfg"
71 + break;
72 + fi
73 + done
74 +fi
75 +# check users config
76 +if [ ! -z "$XDG_CONFIG_HOME" ]; then
77 + cfg="$XDG_CONFIG_HOME/xdg-utils/xdg-utils.rc"
78 + if [ -e "$cfg" ]; then
79 + source "$cfg"
80 + fi
81 +fi
82 +# Update BROWSER variable, based on config file
83 +if [ ! -z "$XDG_GENERIC_BROWSER" ]; then
84 + BROWSER="$XDG_GENERIC_BROWSER:$BROWSER"
85 +fi
87 case "$DE" in
88 kde)
89 open_kde "${mailto}"
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
93 @@ -217,7 +217,11 @@
95 Synopsis
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
102 + desktop entry
104 xdg-mime default application mimetype(s)
106 @@ -669,9 +673,35 @@
107 mv ${default_file}.new $default_file
110 +# This handles backslashes but not quote marks.
111 +first_word()
113 + read first rest
114 + echo "$first"
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"`"
121 + IFS=:
122 + for dir in $search; do
123 + unset IFS
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"
131 + return
132 + done
135 defapp_generic()
137 MIME="$1"
138 + ARG="$2"
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"
142 @@ -682,8 +712,12 @@
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
147 - exit_success
148 + if [ "$ARG" == "--command" ]; then
149 + desktop_file_to_binary "$trader_result"
150 + else
151 + echo $trader_result
152 + fi
153 + exit_success
155 done
156 exit_success
157 @@ -756,6 +790,7 @@
158 default)
159 action=defapp
160 mimetype="$2"
161 + mimetype_arg="$3"
162 if [ -z "$mimetype" ] ; then
163 exit_failure_syntax "mimetype argument missing"
165 @@ -864,7 +899,7 @@
169 - defapp_generic "$mimetype"
170 + defapp_generic "$mimetype" "$mimetype_arg"
172 esac
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
177 @@ -33,6 +33,8 @@
179 #---------------------------------------------
181 +oldIFS=$IFS
183 manualpage()
185 cat << _MANUALPAGE
186 @@ -409,8 +411,39 @@
191 +open_generic_browser()
193 + IFS=":"
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;
200 + fi
202 + if [ x"$browser_with_arg" = x"$browser" ]; then
203 + "$browser" "$1";
204 + else eval '$browser_with_arg'$xdg_redirect_output;
205 + fi
207 + if [ $? -eq 0 ]; then
208 + exit_success;
209 + fi
210 + fi
211 + done
214 open_generic()
216 + if [ ! -z "$XDG_GENERIC_OPEN" ]; then
217 + $XDG_GENERIC_OPEN "$1"
218 + if [ $? -eq 0 ]; then
219 + exit_success
220 + fi
221 + fi
223 # Paths or file:// URLs
224 if (echo "$1" | grep -q '^file://' ||
225 ! echo "$1" | egrep -q '^[a-zA-Z+\.\-]+:'); then
226 @@ -442,25 +475,7 @@
230 - IFS=":"
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;
237 - fi
239 - if [ x"$browser_with_arg" = x"$browser" ]; then
240 - "$browser" "$1";
241 - else eval '$browser_with_arg'$xdg_redirect_output;
242 - fi
244 - if [ $? -eq 0 ]; then
245 - exit_success;
246 - fi
247 - fi
248 - done
249 + open_generic_browser "$1"
251 exit_failure_operation_impossible "no method available for opening '$1'"
253 @@ -516,6 +531,15 @@
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
260 + exit_success
261 + else
262 + exit_failure_operation_failed
263 + fi
266 detectDE
268 if [ x"$DE" = x"" ]; then
269 @@ -530,6 +554,30 @@
273 +# check system config
274 +if [ ! -z "$XDG_CONFIG_DIRS" ]; then
275 + IFS=":"
276 + for dir in $XDG_CONFIG_DIRS
277 + do
278 + cfg="$dir/xdg-utils/xdg-utils.rc"
279 + if [ -e "$cfg" ]; then
280 + source "$cfg"
281 + break;
282 + fi
283 + done
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
289 + source "$cfg"
290 + fi
292 +# Update BROWSER variable, based on config file
293 +if [ ! -z "$XDG_GENERIC_BROWSER" ]; then
294 + BROWSER="$XDG_GENERIC_BROWSER:$BROWSER"
297 case "$DE" in
298 kde)
299 open_kde "$url"
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
303 @@ -859,6 +859,35 @@
305 detectDE
307 +if [ x"$DE" = x"" ]; then
308 + DE=generic
311 +# check system config
312 +if [ ! -z "$XDG_CONFIG_DIRS" ]; then
313 + IFS=":"
314 + for dir in $XDG_CONFIG_DIRS
315 + do
316 + cfg="$dir/xdg-utils/xdg-utils.rc"
317 + if [ -e "$cfg" ]; then
318 + source "$cfg"
319 + break;
320 + fi
321 + done
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
327 + source "$cfg"
328 + fi
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"
336 case "$DE" in
337 kde|gnome|xfce)
338 dispatch_specific "$@"