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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 binary="`which "$1"`" | 516 binary="`which "$1"`" |
517 base="`basename "$1"`" | 517 base="`basename "$1"`" |
518 IFS=: | 518 IFS=: |
519 for dir in $search; do | 519 for dir in $search; do |
520 unset IFS | 520 unset IFS |
521 [ "$dir" -a -d "$dir/applications" ] || continue | 521 [ "$dir" -a -d "$dir/applications" ] || continue |
522 for file in "$dir"/applications/*.desktop; do | 522 for file in "$dir"/applications/*.desktop; do |
523 [ -r "$file" ] || continue | 523 [ -r "$file" ] || continue |
524 # Check to make sure it's worth the processing | 524 # Check to make sure it's worth the processing |
525 grep -q "^Exec.*$base" "$file" || continue | 525 grep -q "^Exec.*$base" "$file" || continue |
| 526 # Make sure it's a visible desktop file (e.g. not "preferred-web-bro
wser.desktop") |
| 527 grep -q "^NoDisplay=true" "$file" && continue |
526 command="`grep "^Exec\(\[[^]=]*]\)\?=" "$file" | cut -d= -f 2- | fir
st_word`" | 528 command="`grep "^Exec\(\[[^]=]*]\)\?=" "$file" | cut -d= -f 2- | fir
st_word`" |
527 full="`which "$command"`" | 529 full="`which "$command"`" |
528 if [ x"$full" = x"$binary" ]; then | 530 if [ x"$full" = x"$binary" ]; then |
529 # Fix any double slashes that got added path composition | 531 # Fix any double slashes that got added path composition |
530 echo "$file" | sed -e 's,//*,/,g' | 532 echo "$file" | sed -e 's,//*,/,g' |
531 return | 533 return |
532 fi | 534 fi |
533 done | 535 done |
534 done | 536 done |
535 } | 537 } |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 ;; | 810 ;; |
809 | 811 |
810 generic) | 812 generic) |
811 dispatch_generic "$@" | 813 dispatch_generic "$@" |
812 ;; | 814 ;; |
813 | 815 |
814 *) | 816 *) |
815 exit_failure_operation_impossible "unknown desktop environment" | 817 exit_failure_operation_impossible "unknown desktop environment" |
816 ;; | 818 ;; |
817 esac | 819 esac |
OLD | NEW |