OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 #--------------------------------------------- | 2 #--------------------------------------------- |
3 # xdg-open | 3 # xdg-open |
4 # | 4 # |
5 # Utility script to open a URL in the registered default application. | 5 # Utility script to open a URL in the registered default application. |
6 # | 6 # |
7 # Refer to the usage() function below for usage. | 7 # Refer to the usage() function below for usage. |
8 # | 8 # |
| 9 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> |
| 10 # Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> |
9 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> | 11 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> |
10 # Copyright 2006, Jeremy White <jwhite@codeweavers.com> | 12 # Copyright 2006, Jeremy White <jwhite@codeweavers.com> |
11 # | 13 # |
12 # LICENSE: | 14 # LICENSE: |
13 # | 15 # |
14 #--------------------------------------------- | 16 #--------------------------------------------- |
15 | 17 |
16 manualpage() | 18 manualpage() |
17 { | 19 { |
18 cat << _MANUALPAGE | 20 cat << _MANUALPAGE |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 156 |
155 if [ $? -eq 0 ]; then | 157 if [ $? -eq 0 ]; then |
156 exit_success; | 158 exit_success; |
157 fi | 159 fi |
158 fi | 160 fi |
159 done | 161 done |
160 | 162 |
161 exit_failure_operation_impossible "no method available for opening '$1'" | 163 exit_failure_operation_impossible "no method available for opening '$1'" |
162 } | 164 } |
163 | 165 |
| 166 open_lxde() |
| 167 { |
| 168 # pcmanfm only knows how to handle file:// urls and filepaths, it seems. |
| 169 if (echo "$1" | grep -q '^file://' || |
| 170 ! echo "$1" | egrep -q '^[a-zA-Z+\.\-]+:') |
| 171 then |
| 172 local file="$(echo "$1" | sed 's%^file://%%')" |
| 173 |
| 174 # handle relative paths |
| 175 if ! echo "$file" | grep -q '^/'; then |
| 176 file="$(pwd)/$file" |
| 177 fi |
| 178 |
| 179 pcmanfm "$file" |
| 180 |
| 181 else |
| 182 open_generic "$1" |
| 183 fi |
| 184 |
| 185 if [ $? -eq 0 ]; then |
| 186 exit_success |
| 187 else |
| 188 exit_failure_operation_failed |
| 189 fi |
| 190 } |
| 191 |
164 [ x"$1" != x"" ] || exit_failure_syntax | 192 [ x"$1" != x"" ] || exit_failure_syntax |
165 | 193 |
166 url= | 194 url= |
167 while [ $# -gt 0 ] ; do | 195 while [ $# -gt 0 ] ; do |
168 parm="$1" | 196 parm="$1" |
169 shift | 197 shift |
170 | 198 |
171 case "$parm" in | 199 case "$parm" in |
172 -*) | 200 -*) |
173 exit_failure_syntax "unexpected option '$parm'" | 201 exit_failure_syntax "unexpected option '$parm'" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 ;; | 234 ;; |
207 | 235 |
208 gnome) | 236 gnome) |
209 open_gnome "$url" | 237 open_gnome "$url" |
210 ;; | 238 ;; |
211 | 239 |
212 xfce) | 240 xfce) |
213 open_xfce "$url" | 241 open_xfce "$url" |
214 ;; | 242 ;; |
215 | 243 |
| 244 lxde) |
| 245 open_lxde "$url" |
| 246 ;; |
| 247 |
216 generic) | 248 generic) |
217 open_generic "$url" | 249 open_generic "$url" |
218 ;; | 250 ;; |
219 | 251 |
220 *) | 252 *) |
221 exit_failure_operation_impossible "no method available for opening '$url'" | 253 exit_failure_operation_impossible "no method available for opening '$url'" |
222 ;; | 254 ;; |
223 esac | 255 esac |
OLD | NEW |