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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 { | 446 { |
447 echo "$browser" | grep -q '^!' | 447 echo "$browser" | grep -q '^!' |
448 if [ $? -ne 0 ]; then | 448 if [ $? -ne 0 ]; then |
449 echo "$browser" | 449 echo "$browser" |
450 else | 450 else |
451 binary="${browser#!}" | 451 binary="${browser#!}" |
452 parse_binary_or_desktop | 452 parse_binary_or_desktop |
453 fi | 453 fi |
454 } | 454 } |
455 | 455 |
| 456 read_kde_browser() |
| 457 { |
| 458 browser="`kreadconfig --file kdeglobals --group General --key BrowserApplica
tion`" |
| 459 if [ "$browser" ]; then |
| 460 echo "$browser" |
| 461 fi |
| 462 # kreadconfig in KDE 4 may not notice Key[$*]=... localized settings, so che
ck |
| 463 # by hand if it didn't find anything (oddly kwriteconfig works fine though) |
| 464 kdeglobals="$HOME/.kde/share/config/kdeglobals" |
| 465 [ ! -f "$kdeglobals" ] && return |
| 466 # This will only take the first value if there is more than one |
| 467 grep '^BrowserApplication\[$[^]=]*\]=' "$kdeglobals" | head -n 1 | cut -d= -
f 2- |
| 468 } |
| 469 |
456 get_browser_kde() | 470 get_browser_kde() |
457 { | 471 { |
458 browser="`kreadconfig --file kdeglobals --group General --key BrowserApplica
tion`" | 472 browser="`read_kde_browser`" |
459 if [ x"$browser" = x ]; then | 473 if [ x"$browser" = x ]; then |
460 # No explicit default browser; KDE will use the MIME type text/html | 474 # No explicit default browser; KDE will use the MIME type text/html |
461 get_browser_mime | 475 get_browser_mime |
462 else | 476 else |
463 resolve_kde_browser | 477 resolve_kde_browser |
464 fi | 478 fi |
465 } | 479 } |
466 | 480 |
467 check_browser_kde() | 481 check_browser_kde() |
468 { | 482 { |
469 browser="`kreadconfig --file kdeglobals --group General --key BrowserApplica
tion`" | 483 browser="`read_kde_browser`" |
470 browser="`resolve_kde_browser`" | 484 browser="`resolve_kde_browser`" |
471 # Because KDE will use the handler for MIME type text/html if this value | 485 # Because KDE will use the handler for MIME type text/html if this value |
472 # is empty, we allow either the empty string or a match to $1 here | 486 # is empty, we allow either the empty string or a match to $1 here |
473 if [ x"$browser" != x -a x"$browser" != x"$1" ]; then | 487 if [ x"$browser" != x -a x"$browser" != x"$1" ]; then |
474 echo no | 488 echo no |
475 exit_success | 489 exit_success |
476 fi | 490 fi |
477 browser="`get_browser_mime`" | 491 browser="`get_browser_mime`" |
478 if [ x"$browser" != x"$1" ]; then | 492 if [ x"$browser" != x"$1" ]; then |
479 echo no | 493 echo no |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 ;; | 808 ;; |
795 | 809 |
796 generic) | 810 generic) |
797 dispatch_generic "$@" | 811 dispatch_generic "$@" |
798 ;; | 812 ;; |
799 | 813 |
800 *) | 814 *) |
801 exit_failure_operation_impossible "unknown desktop environment" | 815 exit_failure_operation_impossible "unknown desktop environment" |
802 ;; | 816 ;; |
803 esac | 817 esac |
OLD | NEW |