| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 #--------------------------------------------- | 2 #--------------------------------------------- |
| 3 # xdg-desktop-icon | 3 # xdg-desktop-icon |
| 4 # | 4 # |
| 5 # Utility script to install desktop items on a Linux desktop. | 5 # Utility script to install desktop items on a Linux desktop. |
| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 # All output to stderr | 397 # All output to stderr |
| 398 xdg_redirect_output=" >&2" | 398 xdg_redirect_output=" >&2" |
| 399 fi | 399 fi |
| 400 | 400 |
| 401 #-------------------------------------- | 401 #-------------------------------------- |
| 402 # Checks for known desktop environments | 402 # Checks for known desktop environments |
| 403 # set variable DE to the desktop environments name, lowercase | 403 # set variable DE to the desktop environments name, lowercase |
| 404 | 404 |
| 405 detectDE() | 405 detectDE() |
| 406 { | 406 { |
| 407 # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 |
| 408 unset GREP_OPTIONS |
| 409 |
| 407 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 410 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
| 408 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 411 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; |
| 409 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; | 412 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; |
| 410 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; | 413 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; |
| 414 elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>
&1; then DE=xfce |
| 411 fi | 415 fi |
| 412 | 416 |
| 413 if [ x"$DE" = x"" ]; then | 417 if [ x"$DE" = x"" ]; then |
| 414 # fallback to checking $DESKTOP_SESSION | 418 # fallback to checking $DESKTOP_SESSION |
| 415 case "$DESKTOP_SESSION" in | 419 case "$DESKTOP_SESSION" in |
| 420 gnome) |
| 421 DE=gnome; |
| 416 LXDE) | 422 LXDE) |
| 417 DE=lxde; | 423 DE=lxde; |
| 418 ;; | 424 ;; |
| 419 xfce|xfce4) | 425 xfce|xfce4) |
| 420 DE=xfce; | 426 DE=xfce; |
| 421 ;; | 427 ;; |
| 422 esac | 428 esac |
| 423 fi | 429 fi |
| 424 | 430 |
| 425 if [ x"$DE" = x"" ]; then | 431 if [ x"$DE" = x"" ]; then |
| (...skipping 12 matching lines...) Expand all Loading... |
| 438 fi | 444 fi |
| 439 } | 445 } |
| 440 | 446 |
| 441 #---------------------------------------------------------------------------- | 447 #---------------------------------------------------------------------------- |
| 442 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 448 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
| 443 # It also always returns 1 in KDE 3.4 and earlier | 449 # It also always returns 1 in KDE 3.4 and earlier |
| 444 # Simply return 0 in such case | 450 # Simply return 0 in such case |
| 445 | 451 |
| 446 kfmclient_fix_exit_code() | 452 kfmclient_fix_exit_code() |
| 447 { | 453 { |
| 448 [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; | |
| 449 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` | 454 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` |
| 450 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` | 455 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` |
| 451 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` | 456 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` |
| 452 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 457 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
| 453 test "$major" -gt 3 && return $1 | 458 test "$major" -gt 3 && return $1 |
| 454 test "$minor" -gt 5 && return $1 | 459 test "$minor" -gt 5 && return $1 |
| 455 test "$release" -gt 4 && return $1 | 460 test "$release" -gt 4 && return $1 |
| 456 return 0 | 461 return 0 |
| 457 } | 462 } |
| 458 | 463 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 rm -f "$x/$basefile" | 583 rm -f "$x/$basefile" |
| 579 fi | 584 fi |
| 580 done | 585 done |
| 581 | 586 |
| 582 ;; | 587 ;; |
| 583 esac | 588 esac |
| 584 | 589 |
| 585 exit_success | 590 exit_success |
| 586 | 591 |
| 587 | 592 |
| OLD | NEW |