From 956144024c046f146c97a4a1f2da3bbd06fca4df Mon Sep 17 00:00:00 2001 From: David Runge Date: Thu, 20 Feb 2014 14:25:14 +0100 Subject: Outsourcing xset settings to a tmp file for reusing, when reenabling the screensaver/dpms. Also disabling dpms now, so the feature will actually work... --- bin/adjust_dpms | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'bin/adjust_dpms') diff --git a/bin/adjust_dpms b/bin/adjust_dpms index 76d2bd5..0f56b46 100755 --- a/bin/adjust_dpms +++ b/bin/adjust_dpms @@ -40,15 +40,26 @@ done # if valuable programs are running, don't use screen blanking if [ $blankoff -gt 0 ]; then - echo "$blankoff" echo "Some program requires screensaver to be off." + # print currently set values for screensaver timeout to tmp file + echo "$(xset q|grep timeout|awk '{print $2}') $(xset q|grep timeout|awk '{print $4}')" > /tmp/xset_screensaver + echo "$(xset q|grep Standby|awk '{print $2}') $(xset q|grep Standby|awk '{print $4}') $(xset q|grep Standby|awk '{print $6}')" > /tmp/xset_dpms + # disable screensaver and dpms xset s off + xset -dpms # else set 360 seconds as blank time else xsetq=$(xset q|grep timeout|awk '{print $2}') + # if the timeout is still 0, set it to its former value, or just switch on screensaver/dpms again if [ $xsetq -eq 0 ];then -# xset s 360 360 - xset s on + if [[ -f /tmp/xset_screensaver && -f /tmp/xset_dpms ]];then + xset s $(cat /tmp/xset_screensaver) + xset dpms $(cat /tmp/xset_dpms) + rm -rf /tmp/xset_screensaver /tmp/xset_dpms + else + xset +dpms + xset s on + fi fi fi -- cgit v1.2.3-54-g00ecf