#!/bin/bash # Script to adjust dpms settings when running certain programs, # that don't use fullscreen, but should not be "blanked" in between. # Run as timed script with systemd from /etc/systemd/system/timer-minutely.target.wants export DISPLAY=:0 config="/home/dave/.config/dpms" blankoff=0 # check for config file existence if [[ -f $config ]];then . /home/dave/.config/dpms else echo "Config file not readable $config" exit 1 fi # loop all pre-compiled programs and check for running instances for i in "${programs[@]}" do pid=$(pidof $i) re='^[0-9]+$' if [[ $pid =~ $re ]]; then echo "$i running ($pid)" $blankoff=1 fi done # loop all python2 run programs and check for running instances for i in "${python2[@]}" do pid=$(pidof python2 $i) re='^[0-9]+$' if [[ $pid =~ $re ]]; then echo "$i running ($pid)" $blankoff=1 fi 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." xset s off else xset s on fi