| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 # All output to stderr | 304 # All output to stderr |
| 305 xdg_redirect_output=" >&2" | 305 xdg_redirect_output=" >&2" |
| 306 fi | 306 fi |
| 307 | 307 |
| 308 #-------------------------------------- | 308 #-------------------------------------- |
| 309 # Checks for known desktop environments | 309 # Checks for known desktop environments |
| 310 # set variable DE to the desktop environments name, lowercase | 310 # set variable DE to the desktop environments name, lowercase |
| 311 | 311 |
| 312 detectDE() | 312 detectDE() |
| 313 { | 313 { |
| 314 # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 |
| 315 unset GREP_OPTIONS |
| 316 |
| 314 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 317 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
| 315 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 318 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; | 319 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; | 320 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; |
| 321 elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>
&1; then DE=xfce |
| 318 fi | 322 fi |
| 319 | 323 |
| 320 if [ x"$DE" = x"" ]; then | 324 if [ x"$DE" = x"" ]; then |
| 321 # fallback to checking $DESKTOP_SESSION | 325 # fallback to checking $DESKTOP_SESSION |
| 322 case "$DESKTOP_SESSION" in | 326 case "$DESKTOP_SESSION" in |
| 327 gnome) |
| 328 DE=gnome; |
| 323 LXDE) | 329 LXDE) |
| 324 DE=lxde; | 330 DE=lxde; |
| 325 ;; | 331 ;; |
| 326 xfce|xfce4) | 332 xfce|xfce4) |
| 327 DE=xfce; | 333 DE=xfce; |
| 328 ;; | 334 ;; |
| 329 esac | 335 esac |
| 330 fi | 336 fi |
| 331 | 337 |
| 332 if [ x"$DE" = x"" ]; then | 338 if [ x"$DE" = x"" ]; then |
| (...skipping 12 matching lines...) Expand all Loading... |
| 345 fi | 351 fi |
| 346 } | 352 } |
| 347 | 353 |
| 348 #---------------------------------------------------------------------------- | 354 #---------------------------------------------------------------------------- |
| 349 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 355 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
| 350 # It also always returns 1 in KDE 3.4 and earlier | 356 # It also always returns 1 in KDE 3.4 and earlier |
| 351 # Simply return 0 in such case | 357 # Simply return 0 in such case |
| 352 | 358 |
| 353 kfmclient_fix_exit_code() | 359 kfmclient_fix_exit_code() |
| 354 { | 360 { |
| 355 [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; | |
| 356 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` | 361 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` |
| 357 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` | 362 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` |
| 358 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` | 363 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` |
| 359 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 364 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
| 360 test "$major" -gt 3 && return $1 | 365 test "$major" -gt 3 && return $1 |
| 361 test "$minor" -gt 5 && return $1 | 366 test "$minor" -gt 5 && return $1 |
| 362 test "$release" -gt 4 && return $1 | 367 test "$release" -gt 4 && return $1 |
| 363 return 0 | 368 return 0 |
| 364 } | 369 } |
| 365 | 370 |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 ;; | 950 ;; |
| 946 | 951 |
| 947 generic) | 952 generic) |
| 948 dispatch_generic "$@" | 953 dispatch_generic "$@" |
| 949 ;; | 954 ;; |
| 950 | 955 |
| 951 *) | 956 *) |
| 952 exit_failure_operation_impossible "unknown desktop environment" | 957 exit_failure_operation_impossible "unknown desktop environment" |
| 953 ;; | 958 ;; |
| 954 esac | 959 esac |
| OLD | NEW |