| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 #--------------------------------------------- | 2 #--------------------------------------------- |
| 3 # xdg-open | 3 # xdg-open |
| 4 # | 4 # |
| 5 # Utility script to open a URL in the registered default application. | 5 # Utility script to open a URL in the registered default application. |
| 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-2010, Fathi Boudra <fabo@freedesktop.org> | 9 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> |
| 10 # Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> | 10 # Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 # All output to stderr | 296 # All output to stderr |
| 297 xdg_redirect_output=" >&2" | 297 xdg_redirect_output=" >&2" |
| 298 fi | 298 fi |
| 299 | 299 |
| 300 #-------------------------------------- | 300 #-------------------------------------- |
| 301 # Checks for known desktop environments | 301 # Checks for known desktop environments |
| 302 # set variable DE to the desktop environments name, lowercase | 302 # set variable DE to the desktop environments name, lowercase |
| 303 | 303 |
| 304 detectDE() | 304 detectDE() |
| 305 { | 305 { |
| 306 # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 |
| 307 unset GREP_OPTIONS |
| 308 |
| 306 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 309 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
| 307 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 310 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; |
| 308 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; | 311 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; |
| 309 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; | 312 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; |
| 313 elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>
&1; then DE=xfce |
| 310 fi | 314 fi |
| 311 | 315 |
| 312 if [ x"$DE" = x"" ]; then | 316 if [ x"$DE" = x"" ]; then |
| 313 # fallback to checking $DESKTOP_SESSION | 317 # fallback to checking $DESKTOP_SESSION |
| 314 case "$DESKTOP_SESSION" in | 318 case "$DESKTOP_SESSION" in |
| 319 gnome) |
| 320 DE=gnome; |
| 315 LXDE) | 321 LXDE) |
| 316 DE=lxde; | 322 DE=lxde; |
| 317 ;; | 323 ;; |
| 318 xfce|xfce4) | 324 xfce|xfce4) |
| 319 DE=xfce; | 325 DE=xfce; |
| 320 ;; | 326 ;; |
| 321 esac | 327 esac |
| 322 fi | 328 fi |
| 323 | 329 |
| 324 if [ x"$DE" = x"" ]; then | 330 if [ x"$DE" = x"" ]; then |
| (...skipping 12 matching lines...) Expand all Loading... |
| 337 fi | 343 fi |
| 338 } | 344 } |
| 339 | 345 |
| 340 #---------------------------------------------------------------------------- | 346 #---------------------------------------------------------------------------- |
| 341 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 347 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
| 342 # It also always returns 1 in KDE 3.4 and earlier | 348 # It also always returns 1 in KDE 3.4 and earlier |
| 343 # Simply return 0 in such case | 349 # Simply return 0 in such case |
| 344 | 350 |
| 345 kfmclient_fix_exit_code() | 351 kfmclient_fix_exit_code() |
| 346 { | 352 { |
| 347 [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; | |
| 348 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` | 353 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` |
| 349 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` | 354 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` |
| 350 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` | 355 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` |
| 351 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 356 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
| 352 test "$major" -gt 3 && return $1 | 357 test "$major" -gt 3 && return $1 |
| 353 test "$minor" -gt 5 && return $1 | 358 test "$minor" -gt 5 && return $1 |
| 354 test "$release" -gt 4 && return $1 | 359 test "$release" -gt 4 && return $1 |
| 355 return 0 | 360 return 0 |
| 356 } | 361 } |
| 357 | 362 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 fi | 579 fi |
| 575 | 580 |
| 576 detectDE | 581 detectDE |
| 577 | 582 |
| 578 if [ x"$DE" = x"" ]; then | 583 if [ x"$DE" = x"" ]; then |
| 579 DE=generic | 584 DE=generic |
| 580 fi | 585 fi |
| 581 | 586 |
| 582 # if BROWSER variable is not set, check some well known browsers instead | 587 # if BROWSER variable is not set, check some well known browsers instead |
| 583 if [ x"$BROWSER" = x"" ]; then | 588 if [ x"$BROWSER" = x"" ]; then |
| 584 BROWSER=links2:links:lynx:w3m | 589 BROWSER=links2:elinks:links:lynx:w3m |
| 585 if [ -n "$DISPLAY" ]; then | 590 if [ -n "$DISPLAY" ]; then |
| 586 BROWSER=firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrom
e:$BROWSER | 591 BROWSER=x-www-browser:firefox:seamonkey:mozilla:epiphany:konqueror:chrom
ium-browser:google-chrome:$BROWSER |
| 587 fi | 592 fi |
| 588 fi | 593 fi |
| 589 | 594 |
| 590 case "$DE" in | 595 case "$DE" in |
| 591 kde) | 596 kde) |
| 592 open_kde "$url" | 597 open_kde "$url" |
| 593 ;; | 598 ;; |
| 594 | 599 |
| 595 gnome*) | 600 gnome*) |
| 596 open_gnome "$url" | 601 open_gnome "$url" |
| 597 ;; | 602 ;; |
| 598 | 603 |
| 599 xfce) | 604 xfce) |
| 600 open_xfce "$url" | 605 open_xfce "$url" |
| 601 ;; | 606 ;; |
| 602 | 607 |
| 603 lxde) | 608 lxde) |
| 604 open_lxde "$url" | 609 open_lxde "$url" |
| 605 ;; | 610 ;; |
| 606 | 611 |
| 607 generic) | 612 generic) |
| 608 open_generic "$url" | 613 open_generic "$url" |
| 609 ;; | 614 ;; |
| 610 | 615 |
| 611 *) | 616 *) |
| 612 exit_failure_operation_impossible "no method available for opening '$url'" | 617 exit_failure_operation_impossible "no method available for opening '$url'" |
| 613 ;; | 618 ;; |
| 614 esac | 619 esac |
| OLD | NEW |