| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 #--------------------------------------------- | 2 #--------------------------------------------- |
| 3 # xdg-screensaver | 3 # xdg-screensaver |
| 4 # | 4 # |
| 5 # Utility script to control screensaver. | 5 # Utility script to control screensaver. |
| 6 # | 6 # |
| 7 # Refer to the usage() function below for usage. | 7 # Refer to the usage() function below for usage. |
| 8 # | 8 # |
| 9 # Copyright 2006, Bryce Harrington <bryce@osdl.org> | 9 # Copyright 2006, Bryce Harrington <bryce@osdl.org> |
| 10 # | 10 # |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 # All output to stderr | 324 # All output to stderr |
| 325 xdg_redirect_output=" >&2" | 325 xdg_redirect_output=" >&2" |
| 326 fi | 326 fi |
| 327 | 327 |
| 328 #-------------------------------------- | 328 #-------------------------------------- |
| 329 # Checks for known desktop environments | 329 # Checks for known desktop environments |
| 330 # set variable DE to the desktop environments name, lowercase | 330 # set variable DE to the desktop environments name, lowercase |
| 331 | 331 |
| 332 detectDE() | 332 detectDE() |
| 333 { | 333 { |
| 334 # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 |
| 335 unset GREP_OPTIONS |
| 336 |
| 334 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 337 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
| 335 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 338 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; |
| 336 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; | 339 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; |
| 337 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; | 340 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; |
| 341 elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>
&1; then DE=xfce |
| 338 fi | 342 fi |
| 339 | 343 |
| 340 if [ x"$DE" = x"" ]; then | 344 if [ x"$DE" = x"" ]; then |
| 341 # fallback to checking $DESKTOP_SESSION | 345 # fallback to checking $DESKTOP_SESSION |
| 342 case "$DESKTOP_SESSION" in | 346 case "$DESKTOP_SESSION" in |
| 347 gnome) |
| 348 DE=gnome; |
| 343 LXDE) | 349 LXDE) |
| 344 DE=lxde; | 350 DE=lxde; |
| 345 ;; | 351 ;; |
| 346 xfce|xfce4) | 352 xfce|xfce4) |
| 347 DE=xfce; | 353 DE=xfce; |
| 348 ;; | 354 ;; |
| 349 esac | 355 esac |
| 350 fi | 356 fi |
| 351 | 357 |
| 352 if [ x"$DE" = x"" ]; then | 358 if [ x"$DE" = x"" ]; then |
| (...skipping 12 matching lines...) Expand all Loading... |
| 365 fi | 371 fi |
| 366 } | 372 } |
| 367 | 373 |
| 368 #---------------------------------------------------------------------------- | 374 #---------------------------------------------------------------------------- |
| 369 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 375 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
| 370 # It also always returns 1 in KDE 3.4 and earlier | 376 # It also always returns 1 in KDE 3.4 and earlier |
| 371 # Simply return 0 in such case | 377 # Simply return 0 in such case |
| 372 | 378 |
| 373 kfmclient_fix_exit_code() | 379 kfmclient_fix_exit_code() |
| 374 { | 380 { |
| 375 [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; | |
| 376 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` | 381 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` |
| 377 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` | 382 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` |
| 378 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` | 383 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` |
| 379 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 384 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
| 380 test "$major" -gt 3 && return $1 | 385 test "$major" -gt 3 && return $1 |
| 381 test "$minor" -gt 5 && return $1 | 386 test "$minor" -gt 5 && return $1 |
| 382 test "$release" -gt 4 && return $1 | 387 test "$release" -gt 4 && return $1 |
| 383 return 0 | 388 return 0 |
| 384 } | 389 } |
| 385 | 390 |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 if [ "$action" = "suspend" ] ; then | 980 if [ "$action" = "suspend" ] ; then |
| 976 # Start tracking $window_id and resume the screensaver once it disappears | 981 # Start tracking $window_id and resume the screensaver once it disappears |
| 977 ( track_window ) 2> /dev/null > /dev/null & | 982 ( track_window ) 2> /dev/null > /dev/null & |
| 978 fi | 983 fi |
| 979 | 984 |
| 980 if [ $result -eq 0 ]; then | 985 if [ $result -eq 0 ]; then |
| 981 exit_success | 986 exit_success |
| 982 else | 987 else |
| 983 exit_failure_operation_failed | 988 exit_failure_operation_failed |
| 984 fi | 989 fi |
| OLD | NEW |