| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 #--------------------------------------------- | 2 #--------------------------------------------- |
| 3 # xdg-icon-resource | 3 # xdg-icon-resource |
| 4 # | 4 # |
| 5 # Utility script to install icons on a Linux desktop. | 5 # Utility script to install icons 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 echo "Use 'man xdg-icon-resource' or 'xdg-icon-resource --manual' fo
r additional info." | 365 echo "Use 'man xdg-icon-resource' or 'xdg-icon-resource --manual' fo
r additional info." |
| 366 exit_success | 366 exit_success |
| 367 ;; | 367 ;; |
| 368 | 368 |
| 369 --manual) | 369 --manual) |
| 370 manualpage | 370 manualpage |
| 371 exit_success | 371 exit_success |
| 372 ;; | 372 ;; |
| 373 | 373 |
| 374 --version) | 374 --version) |
| 375 echo "xdg-icon-resource 1.0.2" | 375 echo "xdg-icon-resource 1.1.0 rc1" |
| 376 exit_success | 376 exit_success |
| 377 ;; | 377 ;; |
| 378 esac | 378 esac |
| 379 done | 379 done |
| 380 } | 380 } |
| 381 | 381 |
| 382 check_common_commands "$@" | 382 check_common_commands "$@" |
| 383 | 383 |
| 384 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; | 384 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; |
| 385 if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then | 385 if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then |
| 386 # Be silent | 386 # Be silent |
| 387 xdg_redirect_output=" > /dev/null 2> /dev/null" | 387 xdg_redirect_output=" > /dev/null 2> /dev/null" |
| 388 else | 388 else |
| 389 # All output to stderr | 389 # All output to stderr |
| 390 xdg_redirect_output=" >&2" | 390 xdg_redirect_output=" >&2" |
| 391 fi | 391 fi |
| 392 | 392 |
| 393 #-------------------------------------- | 393 #-------------------------------------- |
| 394 # Checks for known desktop environments | 394 # Checks for known desktop environments |
| 395 # set variable DE to the desktop environments name, lowercase | 395 # set variable DE to the desktop environments name, lowercase |
| 396 | 396 |
| 397 detectDE() | 397 detectDE() |
| 398 { | 398 { |
| 399 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 399 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
| 400 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 400 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; |
| 401 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; | 401 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; |
| 402 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; | 402 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; |
| 403 elif [ x"$DESKTOP_SESSION" == x"LXDE" ]; then DE=lxde; |
| 404 else DE="" |
| 403 fi | 405 fi |
| 404 } | 406 } |
| 405 | 407 |
| 406 #---------------------------------------------------------------------------- | 408 #---------------------------------------------------------------------------- |
| 407 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 409 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
| 408 # It also always returns 1 in KDE 3.4 and earlier | 410 # It also always returns 1 in KDE 3.4 and earlier |
| 409 # Simply return 0 in such case | 411 # Simply return 0 in such case |
| 410 | 412 |
| 411 kfmclient_fix_exit_code() | 413 kfmclient_fix_exit_code() |
| 412 { | 414 { |
| 413 version=`kde${KDE_SESSION_VERSION}-config --version 2>/dev/null | grep KDE` | 415 [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; |
| 414 major=`echo $version | sed 's/KDE: \([0-9]\).*/\1/'` | 416 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` |
| 415 minor=`echo $version | sed 's/KDE: [0-9]*\.\([0-9]\).*/\1/'` | 417 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` |
| 416 release=`echo $version | sed 's/KDE: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 418 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` |
| 419 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
| 417 test "$major" -gt 3 && return $1 | 420 test "$major" -gt 3 && return $1 |
| 418 test "$minor" -gt 5 && return $1 | 421 test "$minor" -gt 5 && return $1 |
| 419 test "$release" -gt 4 && return $1 | 422 test "$release" -gt 4 && return $1 |
| 420 return 0 | 423 return 0 |
| 421 } | 424 } |
| 422 | 425 |
| 423 # Set GTK_UPDATE_ICON_CACHE to gtk-update-icon-cache executable path or | 426 # Set GTK_UPDATE_ICON_CACHE to gtk-update-icon-cache executable path or |
| 424 # to "-" if not found. | 427 # to "-" if not found. |
| 425 GTK_UPDATE_ICON_CACHE= | 428 GTK_UPDATE_ICON_CACHE= |
| 426 find_gtk_update_icon_cache() | 429 find_gtk_update_icon_cache() |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 if [ x"$update" = x"yes" ] ; then | 835 if [ x"$update" = x"yes" ] ; then |
| 833 update_icon_database "$xdg_base_dir" | 836 update_icon_database "$xdg_base_dir" |
| 834 if [ -n "$dot_icon_dir" ] ; then | 837 if [ -n "$dot_icon_dir" ] ; then |
| 835 if [ -d "$dot_icon_dir/" -a ! -L "$dot_icon_dir" ] ; then | 838 if [ -d "$dot_icon_dir/" -a ! -L "$dot_icon_dir" ] ; then |
| 836 update_icon_database $dot_base_dir | 839 update_icon_database $dot_base_dir |
| 837 fi | 840 fi |
| 838 fi | 841 fi |
| 839 fi | 842 fi |
| 840 | 843 |
| 841 exit_success | 844 exit_success |
| OLD | NEW |