--- xdg-screensaver.orig 2015-03-18 14:26:13.000000000 +0400 +++ xdg-screensaver 2015-03-18 14:48:24.277538963 +0400 @@ -571,6 +571,10 @@ screensaver_xscreensaver "$1" ;; + xautolock_screensaver) + xautolock_screensaver "$1" + ;; + '') [ -n "$DISPLAY" ] && screensaver_xserver "$1" ;; @@ -1095,6 +1099,51 @@ esac } +xautolock_screensaver() +{ + case "$1" in + suspend) + xset s off && xautolock -disable > /dev/null + result=$? + ;; + + resume) + xset s default && xautolock -enable > /dev/null + result=$? + ;; + + activate) + xautolock -enable + result=$? + ;; + + lock) + xautolock -locknow + result=$? + ;; + + reset) + xautolock -restart + result=$? + ;; + + status) + xautolock -unlocknow >/dev/null + result=$? + if [ $result -eq 0 ]; then + echo "enabled" + else + echo "disabled" + fi + ;; + + *) + echo "ERROR: Unknown command '$1" >&2 + return 1 + ;; + esac +} + [ x"$1" != x"" ] || exit_failure_syntax action= @@ -1155,6 +1204,8 @@ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.ScreenSaver > /dev/null 2>&1 && DE="gnome_screensaver" # Consider "mate-screensaver" a separate DE dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.mate.ScreenSaver > /dev/null 2>&1 && DE="mate_screensaver" +# Consider "xautolock" a separate DE +xautolock -enable > /dev/null 2>&1 && DE="xautolock_screensaver" if [ "$action" = "resume" ] ; then do_resume