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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 { | 138 { |
139 echo "$browser" | grep -q '^!' | 139 echo "$browser" | grep -q '^!' |
140 if [ $? -ne 0 ]; then | 140 if [ $? -ne 0 ]; then |
141 echo "$browser" | 141 echo "$browser" |
142 else | 142 else |
143 binary="${browser#!}" | 143 binary="${browser#!}" |
144 parse_binary_or_desktop | 144 parse_binary_or_desktop |
145 fi | 145 fi |
146 } | 146 } |
147 | 147 |
| 148 read_kde_browser() |
| 149 { |
| 150 browser="`kreadconfig --file kdeglobals --group General --key BrowserApplica
tion`" |
| 151 if [ "$browser" ]; then |
| 152 echo "$browser" |
| 153 fi |
| 154 # kreadconfig in KDE 4 may not notice Key[$*]=... localized settings, so che
ck |
| 155 # by hand if it didn't find anything (oddly kwriteconfig works fine though) |
| 156 kdeglobals="$HOME/.kde/share/config/kdeglobals" |
| 157 [ ! -f "$kdeglobals" ] && return |
| 158 # This will only take the first value if there is more than one |
| 159 grep '^BrowserApplication\[$[^]=]*\]=' "$kdeglobals" | head -n 1 | cut -d= -
f 2- |
| 160 } |
| 161 |
148 get_browser_kde() | 162 get_browser_kde() |
149 { | 163 { |
150 browser="`kreadconfig --file kdeglobals --group General --key BrowserApplica
tion`" | 164 browser="`read_kde_browser`" |
151 if [ x"$browser" = x ]; then | 165 if [ x"$browser" = x ]; then |
152 # No explicit default browser; KDE will use the MIME type text/html | 166 # No explicit default browser; KDE will use the MIME type text/html |
153 get_browser_mime | 167 get_browser_mime |
154 else | 168 else |
155 resolve_kde_browser | 169 resolve_kde_browser |
156 fi | 170 fi |
157 } | 171 } |
158 | 172 |
159 check_browser_kde() | 173 check_browser_kde() |
160 { | 174 { |
161 browser="`kreadconfig --file kdeglobals --group General --key BrowserApplica
tion`" | 175 browser="`read_kde_browser`" |
162 browser="`resolve_kde_browser`" | 176 browser="`resolve_kde_browser`" |
163 # Because KDE will use the handler for MIME type text/html if this value | 177 # Because KDE will use the handler for MIME type text/html if this value |
164 # is empty, we allow either the empty string or a match to $1 here | 178 # is empty, we allow either the empty string or a match to $1 here |
165 if [ x"$browser" != x -a x"$browser" != x"$1" ]; then | 179 if [ x"$browser" != x -a x"$browser" != x"$1" ]; then |
166 echo no | 180 echo no |
167 exit_success | 181 exit_success |
168 fi | 182 fi |
169 browser="`get_browser_mime`" | 183 browser="`get_browser_mime`" |
170 if [ x"$browser" != x"$1" ]; then | 184 if [ x"$browser" != x"$1" ]; then |
171 echo no | 185 echo no |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 ;; | 500 ;; |
487 | 501 |
488 generic) | 502 generic) |
489 dispatch_generic "$@" | 503 dispatch_generic "$@" |
490 ;; | 504 ;; |
491 | 505 |
492 *) | 506 *) |
493 exit_failure_operation_impossible "unknown desktop environment" | 507 exit_failure_operation_impossible "unknown desktop environment" |
494 ;; | 508 ;; |
495 esac | 509 esac |
OLD | NEW |