aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/adjust_dpms17
1 files changed, 14 insertions, 3 deletions
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