~scriptsdisplay
displaykeep-on.sh
4 months ago• 2 648
{}
#!/bin/bash
#
# Author: Twily 2015
# Description: Waits for the monitor 'off' state to turn back on and dim instead
# (use ~/scripts/screen-dim to toggle lights back up)
# Require: xset, xbacklight
#
export DISPLAY=:0
function keepon() {
xset dpms force on
xset dpms 0 0 0 && xset -dpms && xset s off
#xbacklight -set 0
}
echo -e "keep-on: \033[1;33mWaiting for monitor 'off' state...\033[0m"
CLOGIN=0
while true; do
MON=$(xset -q|grep 'Monitor is')
if [[ $MON == *Off* ]]; then
keepon
echo -e "keep-on: \033[1;32mMonitor turned back on...\033[0m"
echo -e "keep-on: \033[1;32mDimming backlight to 0...\033[0m"
fi
CTEST=$( cat ~/ana-wall-login.log )
if [ "$CTEST" != "$CLOGIN" ] && [ "$CLOGIN" != "0" ]; then
CLOGIN=$CTEST
echo "exec ana-wall-refresh"
./scripts/display/ana-wall-refresh.sh
elif [ "$CLOGIN" == "0" ]; then
echo "setup clogin ready"
CLOGIN=$CTEST
fi
#~/scripts/display/battery_check.sh
echo "loop 1"
sleep 1
done
exit 0
Top
2 158 881 visits