OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 #--------------------------------------------- | 2 #--------------------------------------------- |
3 # xdg-settings | 3 # xdg-settings |
4 # | 4 # |
5 # Utility script to get various settings from the desktop environment. | 5 # Utility script to get various settings from the desktop environment. |
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, Google Inc. | 9 # Copyright 2009, Google Inc. |
10 # | 10 # |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 binary="`which "$1"`" | 208 binary="`which "$1"`" |
209 base="`basename "$1"`" | 209 base="`basename "$1"`" |
210 IFS=: | 210 IFS=: |
211 for dir in $search; do | 211 for dir in $search; do |
212 unset IFS | 212 unset IFS |
213 [ "$dir" -a -d "$dir/applications" ] || continue | 213 [ "$dir" -a -d "$dir/applications" ] || continue |
214 for file in "$dir"/applications/*.desktop; do | 214 for file in "$dir"/applications/*.desktop; do |
215 [ -r "$file" ] || continue | 215 [ -r "$file" ] || continue |
216 # Check to make sure it's worth the processing | 216 # Check to make sure it's worth the processing |
217 grep -q "^Exec.*$base" "$file" || continue | 217 grep -q "^Exec.*$base" "$file" || continue |
| 218 # Make sure it's a visible desktop file (e.g. not "preferred-web-bro
wser.desktop") |
| 219 grep -q "^NoDisplay=true" "$file" && continue |
218 command="`grep "^Exec\(\[[^]=]*]\)\?=" "$file" | cut -d= -f 2- | fir
st_word`" | 220 command="`grep "^Exec\(\[[^]=]*]\)\?=" "$file" | cut -d= -f 2- | fir
st_word`" |
219 full="`which "$command"`" | 221 full="`which "$command"`" |
220 if [ x"$full" = x"$binary" ]; then | 222 if [ x"$full" = x"$binary" ]; then |
221 # Fix any double slashes that got added path composition | 223 # Fix any double slashes that got added path composition |
222 echo "$file" | sed -e 's,//*,/,g' | 224 echo "$file" | sed -e 's,//*,/,g' |
223 return | 225 return |
224 fi | 226 fi |
225 done | 227 done |
226 done | 228 done |
227 } | 229 } |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 ;; | 502 ;; |
501 | 503 |
502 generic) | 504 generic) |
503 dispatch_generic "$@" | 505 dispatch_generic "$@" |
504 ;; | 506 ;; |
505 | 507 |
506 *) | 508 *) |
507 exit_failure_operation_impossible "unknown desktop environment" | 509 exit_failure_operation_impossible "unknown desktop environment" |
508 ;; | 510 ;; |
509 esac | 511 esac |
OLD | NEW |