From 995c8fdaccadab2148a2258e4c8ec7254551bd72 Mon Sep 17 00:00:00 2001 From: Thaddaeus Tintenfisch Date: Thu, 8 Jan 2015 20:07:45 +0100 Subject: [PATCH] Restore previous X11 screensaver timeout --- scripts/xdg-screensaver.in | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/xdg-screensaver.in b/scripts/xdg-screensaver.in index d9cb4d2..0fd2fb1 100644 --- a/scripts/xdg-screensaver.in +++ b/scripts/xdg-screensaver.in @@ -366,16 +366,29 @@ screensaver_kde3() esac } +xset_screensaver_timeout() +{ + xset q | sed '/^Screen Saver:/,/^[^ ]/ { s/.*timeout: *\([0-9]*\).*/\1/; t }; d' +} + screensaver_xserver() { case "$1" in suspend) - xset s off > /dev/null + timeout=`xset_screensaver_timeout` + if [ "$timeout" -gt 0 ]; then + echo "$timeout" > "$screensaver_file.xset" + xset s off > /dev/null + fi result=$? ;; resume) - xset s default > /dev/null + if [ -f "$screensaver_file.xset" ] ; then + value=`cat "$screensaver_file.xset"` + xset s $value > /dev/null + rm -f "$screensaver_file.xset" + fi result=$? ;; @@ -390,7 +403,7 @@ screensaver_xserver() ;; status) - timeout=`xset q | sed '/^Screen Saver:/,/^[^ ]/ { s/.*timeout: *\([0-9]*\).*/\1/; t }; d'` + timeout=`xset_screensaver_timeout` result=$? if [ "$timeout" -gt 0 ]; then echo "enabled" -- 2.1.4