| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 #---------------------------------------------------------------------------- | 122 #---------------------------------------------------------------------------- |
| 123 | 123 |
| 124 DEBUG() | 124 DEBUG() |
| 125 { | 125 { |
| 126 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && return 0; | 126 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && return 0; |
| 127 [ ${XDG_UTILS_DEBUG_LEVEL} -lt $1 ] && return 0; | 127 [ ${XDG_UTILS_DEBUG_LEVEL} -lt $1 ] && return 0; |
| 128 shift | 128 shift |
| 129 echo "$@" >&2 | 129 echo "$@" >&2 |
| 130 } | 130 } |
| 131 | 131 |
| 132 # This handles backslashes but not quote marks. |
| 133 first_word() |
| 134 { |
| 135 read first rest |
| 136 echo "$first" |
| 137 } |
| 138 |
| 139 #------------------------------------------------------------- |
| 140 # map a binary to a .desktop file |
| 141 binary_to_desktop_file() |
| 142 { |
| 143 search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/sha
re:/usr/share}" |
| 144 binary="`which "$1"`" |
| 145 binary="`readlink -f "$binary"`" |
| 146 base="`basename "$binary"`" |
| 147 IFS=: |
| 148 for dir in $search; do |
| 149 unset IFS |
| 150 [ "$dir" ] || continue |
| 151 [ -d "$dir/applications" -o -d "$dir/applnk" ] || continue |
| 152 for file in "$dir"/applications/*.desktop "$dir"/applications/*/*.deskto
p "$dir"/applnk/*.desktop "$dir"/applnk/*/*.desktop; do |
| 153 [ -r "$file" ] || continue |
| 154 # Check to make sure it's worth the processing. |
| 155 grep -q "^Exec.*$base" "$file" || continue |
| 156 # Make sure it's a visible desktop file (e.g. not "preferred-web-bro
wser.desktop"). |
| 157 grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue |
| 158 command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | fir
st_word`" |
| 159 command="`which "$command"`" |
| 160 if [ x"`readlink -f "$command"`" = x"$binary" ]; then |
| 161 # Fix any double slashes that got added path composition |
| 162 echo "$file" | sed -e 's,//*,/,g' |
| 163 return |
| 164 fi |
| 165 done |
| 166 done |
| 167 } |
| 168 |
| 169 #------------------------------------------------------------- |
| 170 # map a .desktop file to a binary |
| 171 ## FIXME: handle vendor dir case |
| 172 desktop_file_to_binary() |
| 173 { |
| 174 search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/sha
re:/usr/share}" |
| 175 desktop="`basename "$1"`" |
| 176 IFS=: |
| 177 for dir in $search; do |
| 178 unset IFS |
| 179 [ "$dir" -a -d "$dir/applications" ] || continue |
| 180 file="$dir/applications/$desktop" |
| 181 [ -r "$file" ] || continue |
| 182 # Remove any arguments (%F, %f, %U, %u, etc.). |
| 183 command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_w
ord`" |
| 184 command="`which "$command"`" |
| 185 readlink -f "$command" |
| 186 return |
| 187 done |
| 188 } |
| 189 |
| 132 #------------------------------------------------------------- | 190 #------------------------------------------------------------- |
| 133 # Exit script on successfully completing the desired operation | 191 # Exit script on successfully completing the desired operation |
| 134 | 192 |
| 135 exit_success() | 193 exit_success() |
| 136 { | 194 { |
| 137 if [ $# -gt 0 ]; then | 195 if [ $# -gt 0 ]; then |
| 138 echo "$@" | 196 echo "$@" |
| 139 echo | 197 echo |
| 140 fi | 198 fi |
| 141 | 199 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 echo "Use 'man xdg-settings' or 'xdg-settings --manual' for addition
al info." | 338 echo "Use 'man xdg-settings' or 'xdg-settings --manual' for addition
al info." |
| 281 exit_success | 339 exit_success |
| 282 ;; | 340 ;; |
| 283 | 341 |
| 284 --manual) | 342 --manual) |
| 285 manualpage | 343 manualpage |
| 286 exit_success | 344 exit_success |
| 287 ;; | 345 ;; |
| 288 | 346 |
| 289 --version) | 347 --version) |
| 290 echo "xdg-settings 1.0.2" | 348 echo "xdg-settings 1.1.0 rc1" |
| 291 exit_success | 349 exit_success |
| 292 ;; | 350 ;; |
| 293 esac | 351 esac |
| 294 done | 352 done |
| 295 } | 353 } |
| 296 | 354 |
| 297 check_common_commands "$@" | 355 check_common_commands "$@" |
| 298 | 356 |
| 299 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; | 357 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; |
| 300 if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then | 358 if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then |
| 301 # Be silent | 359 # Be silent |
| 302 xdg_redirect_output=" > /dev/null 2> /dev/null" | 360 xdg_redirect_output=" > /dev/null 2> /dev/null" |
| 303 else | 361 else |
| 304 # All output to stderr | 362 # All output to stderr |
| 305 xdg_redirect_output=" >&2" | 363 xdg_redirect_output=" >&2" |
| 306 fi | 364 fi |
| 307 | 365 |
| 308 #-------------------------------------- | 366 #-------------------------------------- |
| 309 # Checks for known desktop environments | 367 # Checks for known desktop environments |
| 310 # set variable DE to the desktop environments name, lowercase | 368 # set variable DE to the desktop environments name, lowercase |
| 311 | 369 |
| 312 detectDE() | 370 detectDE() |
| 313 { | 371 { |
| 372 # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 |
| 373 unset GREP_OPTIONS |
| 374 |
| 314 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 375 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
| 315 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 376 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; |
| 316 elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/D
Bus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/nul
l 2>&1` ; then DE=gnome; | 377 elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/D
Bus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/nul
l 2>&1` ; then DE=gnome; |
| 317 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; | 378 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; |
| 379 elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>
&1; then DE=xfce |
| 380 fi |
| 381 |
| 382 if [ x"$DE" = x"" ]; then |
| 383 # fallback to checking $DESKTOP_SESSION |
| 384 case "$DESKTOP_SESSION" in |
| 385 gnome) |
| 386 DE=gnome; |
| 387 ;; |
| 388 LXDE) |
| 389 DE=lxde; |
| 390 ;; |
| 391 xfce|xfce4) |
| 392 DE=xfce; |
| 393 ;; |
| 394 esac |
| 395 fi |
| 396 |
| 397 if [ x"$DE" = x"" ]; then |
| 398 # fallback to uname output for other platforms |
| 399 case "$(uname 2>/dev/null)" in |
| 400 Darwin) |
| 401 DE=darwin; |
| 402 ;; |
| 403 esac |
| 404 fi |
| 405 |
| 406 if [ x"$DE" = x"gnome" ]; then |
| 407 # gnome-default-applications-properties is only available in GNOME 2.x |
| 408 # but not in GNOME 3.x |
| 409 which gnome-default-applications-properties > /dev/null 2>&1 || DE="gnome
3" |
| 318 fi | 410 fi |
| 319 } | 411 } |
| 320 | 412 |
| 321 #---------------------------------------------------------------------------- | 413 #---------------------------------------------------------------------------- |
| 322 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 414 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
| 323 # It also always returns 1 in KDE 3.4 and earlier | 415 # It also always returns 1 in KDE 3.4 and earlier |
| 324 # Simply return 0 in such case | 416 # Simply return 0 in such case |
| 325 | 417 |
| 326 kfmclient_fix_exit_code() | 418 kfmclient_fix_exit_code() |
| 327 { | 419 { |
| 328 version=`kde${KDE_SESSION_VERSION}-config --version 2>/dev/null | grep KDE` | 420 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` |
| 329 major=`echo $version | sed 's/KDE: \([0-9]\).*/\1/'` | 421 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` |
| 330 minor=`echo $version | sed 's/KDE: [0-9]*\.\([0-9]\).*/\1/'` | 422 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` |
| 331 release=`echo $version | sed 's/KDE: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 423 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
| 332 test "$major" -gt 3 && return $1 | 424 test "$major" -gt 3 && return $1 |
| 333 test "$minor" -gt 5 && return $1 | 425 test "$minor" -gt 5 && return $1 |
| 334 test "$release" -gt 4 && return $1 | 426 test "$release" -gt 4 && return $1 |
| 335 return 0 | 427 return 0 |
| 336 } | 428 } |
| 337 | 429 |
| 338 check_desktop_filename() | 430 check_desktop_filename() |
| 339 { | 431 { |
| 340 case "$1" in | 432 case "$1" in |
| 341 */*) | 433 */*) |
| 342 exit_failure_syntax "invalid application name" | 434 exit_failure_syntax "invalid application name" |
| 343 ;; | 435 ;; |
| 344 *.desktop) | 436 *.desktop) |
| 345 return | 437 return |
| 346 ;; | 438 ;; |
| 347 *) | 439 *) |
| 348 exit_failure_syntax "invalid application name" | 440 exit_failure_syntax "invalid application name" |
| 349 ;; | 441 ;; |
| 350 esac | 442 esac |
| 351 } | 443 } |
| 352 | 444 |
| 353 # {{{ default browser | 445 # {{{ default browser |
| 354 # {{{ utility functions | 446 # {{{ utility functions |
| 355 | 447 |
| 356 # This handles backslashes but not quote marks. | |
| 357 first_word() | |
| 358 { | |
| 359 read first rest | |
| 360 echo "$first" | |
| 361 } | |
| 362 | |
| 363 binary_to_desktop_file() | |
| 364 { | |
| 365 search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/sha
re:/usr/share}" | |
| 366 binary="`which "$1"`" | |
| 367 binary="`readlink -f "$binary"`" | |
| 368 base="`basename "$binary"`" | |
| 369 IFS=: | |
| 370 for dir in $search; do | |
| 371 unset IFS | |
| 372 [ "$dir" ] || continue | |
| 373 [ -d "$dir/applications" -o -d "$dir/applnk" ] || continue | |
| 374 for file in "$dir"/applications/*.desktop "$dir"/applnk/*.desktop; do | |
| 375 [ -r "$file" ] || continue | |
| 376 # Check to make sure it's worth the processing. | |
| 377 grep -q "^Exec.*$base" "$file" || continue | |
| 378 # Make sure it's a visible desktop file (e.g. not "preferred-web-bro
wser.desktop"). | |
| 379 grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue | |
| 380 command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | fir
st_word`" | |
| 381 command="`which "$command"`" | |
| 382 if [ x"`readlink -f "$command"`" = x"$binary" ]; then | |
| 383 # Fix any double slashes that got added path composition | |
| 384 echo "$file" | sed -e 's,//*,/,g' | |
| 385 return | |
| 386 fi | |
| 387 done | |
| 388 done | |
| 389 } | |
| 390 | |
| 391 desktop_file_to_binary() | |
| 392 { | |
| 393 search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/sha
re:/usr/share}" | |
| 394 desktop="`basename "$1"`" | |
| 395 IFS=: | |
| 396 for dir in $search; do | |
| 397 unset IFS | |
| 398 [ "$dir" -a -d "$dir/applications" ] || continue | |
| 399 file="$dir/applications/$desktop" | |
| 400 [ -r "$file" ] || continue | |
| 401 # Remove any arguments (%F, %f, %U, %u, etc.). | |
| 402 command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_w
ord`" | |
| 403 command="`which "$command"`" | |
| 404 readlink -f "$command" | |
| 405 return | |
| 406 done | |
| 407 } | |
| 408 | |
| 409 # In order to remove an application from the automatically-generated list of | 448 # In order to remove an application from the automatically-generated list of |
| 410 # applications for handling a given MIME type, the desktop environment may copy | 449 # applications for handling a given MIME type, the desktop environment may copy |
| 411 # the global .desktop file into the user's .local directory, and remove that | 450 # the global .desktop file into the user's .local directory, and remove that |
| 412 # MIME type from its list. In that case, we must restore the MIME type to the | 451 # MIME type from its list. In that case, we must restore the MIME type to the |
| 413 # application's list of MIME types before we can set it as the default for that | 452 # application's list of MIME types before we can set it as the default for that |
| 414 # MIME type. (We can't just delete the local version, since the user may have | 453 # MIME type. (We can't just delete the local version, since the user may have |
| 415 # made other changes to it as well. So, tweak the existing file.) | 454 # made other changes to it as well. So, tweak the existing file.) |
| 416 # This function is hard-coded for text/html but it could be adapted if needed. | 455 # This function is hard-coded for text/html but it could be adapted if needed. |
| 417 fix_local_desktop_file() | 456 fix_local_desktop_file() |
| 418 { | 457 { |
| 458 if test -z "$2" ; then |
| 459 MIME="text/html" |
| 460 else |
| 461 MIME="$2" |
| 462 fi |
| 419 apps="${XDG_DATA_HOME:-$HOME/.local/share}/applications" | 463 apps="${XDG_DATA_HOME:-$HOME/.local/share}/applications" |
| 420 # No local desktop file? | 464 # No local desktop file? |
| 421 [ ! -f "$apps/$1" ] && return | 465 [ ! -f "$apps/$1" ] && return |
| 422 MIME="`grep "^MimeType=" "$apps/$1" | cut -d= -f 2-`" | 466 MIMETYPES="`grep "^MimeType=" "$apps/$1" | cut -d= -f 2-`" |
| 423 case "$MIME" in | 467 case "$MIMETYPES" in |
| 424 text/html\;*|*\;text/html\;*|*\;text/html\;|*\;text/html) | 468 $MIME\;*|*\;$MIME\;*|*\;$MIME\;|*\;$MIME) |
| 425 # Already has text/html? Great! | 469 # Already has the mime-type? Great! |
| 426 return 0 | 470 return 0 |
| 427 ;; | 471 ;; |
| 428 esac | 472 esac |
| 429 | 473 |
| 430 # Add text/html to the list | 474 # Add the mime-type to the list |
| 431 temp="`mktemp "$apps/$1.XXXXXX"`" || return | 475 temp="`mktemp "$apps/$1.XXXXXX"`" || return |
| 432 grep -v "^MimeType=" "$apps/$1" >> "$temp" | 476 grep -v "^MimeType=" "$apps/$1" >> "$temp" |
| 433 echo "MimeType=text/html;$MIME" >> "$temp" | 477 echo "MimeType=$MIME;$MIMETYPES" >> "$temp" |
| 434 | 478 |
| 435 oldlines="`wc -l < "$apps/$1"`" | 479 oldlines="`wc -l < "$apps/$1"`" |
| 436 newlines="`wc -l < "$temp"`" | 480 newlines="`wc -l < "$temp"`" |
| 437 # The new file should have at least as many lines as the old. | 481 # The new file should have at least as many lines as the old. |
| 438 if [ $oldlines -le $newlines ]; then | 482 if [ $oldlines -le $newlines ]; then |
| 439 mv "$temp" "$apps/$1" | 483 mv "$temp" "$apps/$1" |
| 440 # This can take a little bit to get noticed. | 484 # This can take a little bit to get noticed. |
| 441 sleep 4 | 485 sleep 4 |
| 442 else | 486 else |
| 443 rm -f "$temp" | 487 rm -f "$temp" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 457 # copy here, that copy will be used in xdg-mime and we will avoid waiting. | 501 # copy here, that copy will be used in xdg-mime and we will avoid waiting. |
| 458 if [ "$DE" = kde -a -z "$XDG_MIME_FIXED" ]; then | 502 if [ "$DE" = kde -a -z "$XDG_MIME_FIXED" ]; then |
| 459 ktradertest text/html Application > /dev/null 2>&1 | 503 ktradertest text/html Application > /dev/null 2>&1 |
| 460 # Only do this once, as we only need it once. | 504 # Only do this once, as we only need it once. |
| 461 XDG_MIME_FIXED=yes | 505 XDG_MIME_FIXED=yes |
| 462 fi | 506 fi |
| 463 } | 507 } |
| 464 | 508 |
| 465 get_browser_mime() | 509 get_browser_mime() |
| 466 { | 510 { |
| 511 if test -z "$1" ; then |
| 512 MIME="text/html" |
| 513 else |
| 514 MIME="$1" |
| 515 fi |
| 467 xdg_mime_fixup | 516 xdg_mime_fixup |
| 468 xdg-mime query default text/html | 517 xdg-mime query default "$MIME" |
| 469 } | 518 } |
| 470 | 519 |
| 471 set_browser_mime() | 520 set_browser_mime() |
| 472 { | 521 { |
| 473 xdg_mime_fixup | 522 xdg_mime_fixup |
| 474 orig="`get_browser_mime`" | 523 if test -z "$2" ; then |
| 524 MIME="text/html" |
| 525 else |
| 526 MIME="$2" |
| 527 fi |
| 528 orig="`get_browser_mime $MIME`" |
| 475 # Fixing the local desktop file can actually change the default browser all | 529 # Fixing the local desktop file can actually change the default browser all |
| 476 # by itself, so we fix it only after querying to find the current default. | 530 # by itself, so we fix it only after querying to find the current default. |
| 477 fix_local_desktop_file "$1" || return | 531 fix_local_desktop_file "$1" "$MIME" || return |
| 478 mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/applications" | 532 mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/applications" |
| 479 xdg-mime default "$1" text/html || return | 533 xdg-mime default "$1" "$MIME" || return |
| 480 if [ x"`get_browser_mime`" != x"$1" ]; then | 534 if [ x"`get_browser_mime`" != x"$1" ]; then |
| 481 # Put back the original value | 535 # Put back the original value |
| 482 xdg-mime default "$orig" text/html | 536 xdg-mime default "$orig" "$MIME" |
| 483 exit_failure_operation_failed | 537 exit_failure_operation_failed |
| 484 fi | 538 fi |
| 485 } | 539 } |
| 486 | 540 |
| 487 # }}} MIME utilities | 541 # }}} MIME utilities |
| 488 # {{{ KDE | 542 # {{{ KDE |
| 489 | 543 |
| 490 # Resolves the KDE browser setting to a binary: if prefixed with !, simply remov
es it; | 544 # Resolves the KDE browser setting to a binary: if prefixed with !, simply remov
es it; |
| 491 # otherwise, uses desktop_file_to_binary to get the binary out of the desktop fi
le. | 545 # otherwise, uses desktop_file_to_binary to get the binary out of the desktop fi
le. |
| 492 resolve_kde_browser() | 546 resolve_kde_browser() |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 gconftool-2 --type bool --set /desktop/gnome/url-handlers/$protocol/need
s_terminal false | 696 gconftool-2 --type bool --set /desktop/gnome/url-handlers/$protocol/need
s_terminal false |
| 643 gconftool-2 --type bool --set /desktop/gnome/url-handlers/$protocol/enab
led true | 697 gconftool-2 --type bool --set /desktop/gnome/url-handlers/$protocol/enab
led true |
| 644 done | 698 done |
| 645 # Set the handler for about: and unknown URL types. | 699 # Set the handler for about: and unknown URL types. |
| 646 for protocol in about unknown; do | 700 for protocol in about unknown; do |
| 647 gconftool-2 --type string --set /desktop/gnome/url-handlers/$protocol/co
mmand "$binary %s" | 701 gconftool-2 --type string --set /desktop/gnome/url-handlers/$protocol/co
mmand "$binary %s" |
| 648 done | 702 done |
| 649 } | 703 } |
| 650 | 704 |
| 651 # }}} GNOME | 705 # }}} GNOME |
| 706 # {{{ GNOME 3.x |
| 707 |
| 708 get_browser_gnome3() |
| 709 { |
| 710 get_browser_mime "x-scheme-handler/http" |
| 711 } |
| 712 |
| 713 check_browser_gnome3() |
| 714 { |
| 715 desktop="$1" |
| 716 check="`desktop_file_to_binary "$1"`" |
| 717 if [ -z "$check" ]; then |
| 718 echo no |
| 719 exit_success |
| 720 fi |
| 721 # Check HTTP and HTTPS, but not about: and unknown:. |
| 722 for protocol in http https; do |
| 723 browser="`get_browser_mime "x-scheme-handler/$protocol"`" |
| 724 if [ x"$browser" != x"$desktop" ]; then |
| 725 echo no |
| 726 exit_success |
| 727 fi |
| 728 done |
| 729 echo yes |
| 730 exit_success |
| 731 } |
| 732 |
| 733 set_browser_gnome3() |
| 734 { |
| 735 binary="`desktop_file_to_binary "$1"`" |
| 736 [ "$binary" ] || exit_failure_file_missing |
| 737 set_browser_mime "$1" || return |
| 738 |
| 739 # Set the default browser. |
| 740 for protocol in http https about unknown; do |
| 741 set_browser_mime "$1" "x-scheme-handler/$protocol" || return |
| 742 done |
| 743 } |
| 744 # }}} GNOME 3.x |
| 652 # {{{ xfce | 745 # {{{ xfce |
| 653 | 746 |
| 654 get_browser_xfce() | 747 get_browser_xfce() |
| 655 { | 748 { |
| 656 search="${XDG_CONFIG_HOME:-$HOME/.config}:${XDG_CONFIG_DIRS:-/etc/xdg}" | 749 search="${XDG_CONFIG_HOME:-$HOME/.config}:${XDG_CONFIG_DIRS:-/etc/xdg}" |
| 657 IFS=: | 750 IFS=: |
| 658 for dir in $search; do | 751 for dir in $search; do |
| 659 unset IFS | 752 unset IFS |
| 660 [ "$dir" -a -d "$dir/xfce4" ] || continue | 753 [ "$dir" -a -d "$dir/xfce4" ] || continue |
| 661 file="$dir/xfce4/helpers.rc" | 754 file="$dir/xfce4/helpers.rc" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 parm="$2" | 944 parm="$2" |
| 852 shift 2 | 945 shift 2 |
| 853 | 946 |
| 854 if [ x"$op" != x"get" -a x"$op" != x"check" -a x"$op" != x"set" ]; then | 947 if [ x"$op" != x"get" -a x"$op" != x"check" -a x"$op" != x"set" ]; then |
| 855 exit_failure_syntax "invalid operation" | 948 exit_failure_syntax "invalid operation" |
| 856 fi | 949 fi |
| 857 | 950 |
| 858 detectDE | 951 detectDE |
| 859 | 952 |
| 860 case "$DE" in | 953 case "$DE" in |
| 861 kde|gnome|xfce) | 954 kde|gnome*|xfce) |
| 862 dispatch_specific "$@" | 955 dispatch_specific "$@" |
| 863 ;; | 956 ;; |
| 864 | 957 |
| 865 generic) | 958 generic) |
| 866 dispatch_generic "$@" | 959 dispatch_generic "$@" |
| 867 ;; | 960 ;; |
| 868 | 961 |
| 869 *) | 962 *) |
| 870 exit_failure_operation_impossible "unknown desktop environment" | 963 exit_failure_operation_impossible "unknown desktop environment" |
| 871 ;; | 964 ;; |
| 872 esac | 965 esac |
| OLD | NEW |