diff options
author | David Runge <david.runge@frqrec.com> | 2014-02-20 14:25:14 +0100 |
---|---|---|
committer | David Runge <david.runge@frqrec.com> | 2014-02-20 14:25:14 +0100 |
commit | 956144024c046f146c97a4a1f2da3bbd06fca4df (patch) | |
tree | be0b182ef385c116bf529582e0db84669621a149 /bin/adjust_dpms | |
parent | ebc627939ca72e6140a7011b06bcbed0715982dc (diff) | |
download | dotfiles-956144024c046f146c97a4a1f2da3bbd06fca4df.tar.gz dotfiles-956144024c046f146c97a4a1f2da3bbd06fca4df.tar.bz2 dotfiles-956144024c046f146c97a4a1f2da3bbd06fca4df.tar.xz dotfiles-956144024c046f146c97a4a1f2da3bbd06fca4df.zip |
Outsourcing xset settings to a tmp file for reusing, when reenabling the screensaver/dpms. Also disabling dpms now, so the feature will actually work...
Diffstat (limited to 'bin/adjust_dpms')
-rwxr-xr-x | bin/adjust_dpms | 17 |
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 |