| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 echo "Use 'man xdg-desktop-icon' or 'xdg-desktop-icon --manual' for
additional info." | 373 echo "Use 'man xdg-desktop-icon' or 'xdg-desktop-icon --manual' for
additional info." |
| 374 exit_success | 374 exit_success |
| 375 ;; | 375 ;; |
| 376 | 376 |
| 377 --manual) | 377 --manual) |
| 378 manualpage | 378 manualpage |
| 379 exit_success | 379 exit_success |
| 380 ;; | 380 ;; |
| 381 | 381 |
| 382 --version) | 382 --version) |
| 383 echo "xdg-desktop-icon 1.0.2" | 383 echo "xdg-desktop-icon 1.1.0 rc1" |
| 384 exit_success | 384 exit_success |
| 385 ;; | 385 ;; |
| 386 esac | 386 esac |
| 387 done | 387 done |
| 388 } | 388 } |
| 389 | 389 |
| 390 check_common_commands "$@" | 390 check_common_commands "$@" |
| 391 | 391 |
| 392 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; | 392 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; |
| 393 if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then | 393 if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then |
| 394 # Be silent | 394 # Be silent |
| 395 xdg_redirect_output=" > /dev/null 2> /dev/null" | 395 xdg_redirect_output=" > /dev/null 2> /dev/null" |
| 396 else | 396 else |
| 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 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 407 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
| 408 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 408 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; | 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; |
| 410 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; | 410 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; |
| 411 elif [ x"$DESKTOP_SESSION" == x"LXDE" ]; then DE=lxde; |
| 412 else DE="" |
| 411 fi | 413 fi |
| 412 } | 414 } |
| 413 | 415 |
| 414 #---------------------------------------------------------------------------- | 416 #---------------------------------------------------------------------------- |
| 415 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 417 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
| 416 # It also always returns 1 in KDE 3.4 and earlier | 418 # It also always returns 1 in KDE 3.4 and earlier |
| 417 # Simply return 0 in such case | 419 # Simply return 0 in such case |
| 418 | 420 |
| 419 kfmclient_fix_exit_code() | 421 kfmclient_fix_exit_code() |
| 420 { | 422 { |
| 421 version=`kde${KDE_SESSION_VERSION}-config --version 2>/dev/null | grep KDE` | 423 [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; |
| 422 major=`echo $version | sed 's/KDE: \([0-9]\).*/\1/'` | 424 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` |
| 423 minor=`echo $version | sed 's/KDE: [0-9]*\.\([0-9]\).*/\1/'` | 425 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` |
| 424 release=`echo $version | sed 's/KDE: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 426 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` |
| 427 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
| 425 test "$major" -gt 3 && return $1 | 428 test "$major" -gt 3 && return $1 |
| 426 test "$minor" -gt 5 && return $1 | 429 test "$minor" -gt 5 && return $1 |
| 427 test "$release" -gt 4 && return $1 | 430 test "$release" -gt 4 && return $1 |
| 428 return 0 | 431 return 0 |
| 429 } | 432 } |
| 430 | 433 |
| 431 [ x"$1" != x"" ] || exit_failure_syntax | 434 [ x"$1" != x"" ] || exit_failure_syntax |
| 432 | 435 |
| 433 action= | 436 action= |
| 434 desktop_file= | 437 desktop_file= |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 rm -f "$x/$basefile" | 553 rm -f "$x/$basefile" |
| 551 fi | 554 fi |
| 552 done | 555 done |
| 553 | 556 |
| 554 ;; | 557 ;; |
| 555 esac | 558 esac |
| 556 | 559 |
| 557 exit_success | 560 exit_success |
| 558 | 561 |
| 559 | 562 |
| OLD | NEW |