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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 *) | 515 *) |
516 echo "$browser" | 516 echo "$browser" |
517 ;; | 517 ;; |
518 esac | 518 esac |
519 } | 519 } |
520 | 520 |
521 # Reads the KDE browser setting, compensating for a bug in some versions of krea
dconfig. | 521 # Reads the KDE browser setting, compensating for a bug in some versions of krea
dconfig. |
522 read_kde_browser() | 522 read_kde_browser() |
523 { | 523 { |
524 browser="`kreadconfig --file kdeglobals --group General --key BrowserApplica
tion`" | 524 browser="`kreadconfig --file kdeglobals --group General --key BrowserApplica
tion`" |
525 if [ "$browser" ]; then | 525 if [ x"$browser" != x ]; then |
526 echo "$browser" | 526 echo "$browser" |
| 527 else |
| 528 # kreadconfig in KDE 4 may not notice Key[$*]=... localized settings, so |
| 529 # check by hand if it didn't find anything (oddly kwriteconfig works |
| 530 # fine though). |
| 531 kdeglobals_dir=`kde${KDE_SESSION_VERSION}-config --path config | cut -d
':' -f 1` |
| 532 kdeglobals="$kdeglobals_dir/kdeglobals" |
| 533 [ ! -f "$kdeglobals" ] && return |
| 534 # This will only take the first value if there is more than one. |
| 535 grep '^BrowserApplication\[$[^]=]*\]=' "$kdeglobals" | head -n 1 | cut -
d= -f 2- |
527 fi | 536 fi |
528 # kreadconfig in KDE 4 may not notice Key[$*]=... localized settings, so che
ck | |
529 # by hand if it didn't find anything (oddly kwriteconfig works fine though). | |
530 kdeglobals_dir=`kde${KDE_SESSION_VERSION}-config --path config | cut -d ':'
-f 1` | |
531 kdeglobals="$kdeglobals_dir/kdeglobals" | |
532 [ ! -f "$kdeglobals" ] && return | |
533 # This will only take the first value if there is more than one. | |
534 grep '^BrowserApplication\[$[^]=]*\]=' "$kdeglobals" | head -n 1 | cut -d= -
f 2- | |
535 } | 537 } |
536 | 538 |
537 get_browser_kde() | 539 get_browser_kde() |
538 { | 540 { |
539 browser="`read_kde_browser`" | 541 browser="`read_kde_browser`" |
540 if [ x"$browser" = x ]; then | 542 if [ x"$browser" = x ]; then |
541 # No explicit default browser; KDE will use the MIME type text/html. | 543 # No explicit default browser; KDE will use the MIME type text/html. |
542 get_browser_mime | 544 get_browser_mime |
543 else | 545 else |
544 resolve_kde_browser_desktop | 546 resolve_kde_browser_desktop |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 ;; | 863 ;; |
862 | 864 |
863 generic) | 865 generic) |
864 dispatch_generic "$@" | 866 dispatch_generic "$@" |
865 ;; | 867 ;; |
866 | 868 |
867 *) | 869 *) |
868 exit_failure_operation_impossible "unknown desktop environment" | 870 exit_failure_operation_impossible "unknown desktop environment" |
869 ;; | 871 ;; |
870 esac | 872 esac |
OLD | NEW |