Time-of-day Screensaver setting for lightdm

I have a small 7 inch touch screen attached to a Raspberry Pi which is only used to display my Solar production “kiosk” web page. After a recent update, the touch screen axis got inverted and a few minor annoyances. Today I came up with a script that disables the screensaver in lightdm at 7:01 AM and then re-enables it at 11PM. It’s pretty simple. Cron runs the script at 7:01 and 23:01.

 

#!/bin/bash

#essentially, we are looking at the clock, if we are past a certain time, we dis/enable the screensaver.

#off at 7am

#on at 11pm

LPID=`cat /var/run/lightdm.pid`

#xserver-command=X -s 0 dpms

#/etc/lightdm/lightdm.conf

if [ `date +%H` -gt 23 ];then

sed -i ‘s/xserver-command=X -s 0 dpms/#xserver-command=X -s 0 dpms/g’ /etc/lightdm/lightdm.conf

kill -1 $LPID

elif [ `date +%H` -gt 7 ];then

sed -i ‘s/#xserver-command=X -s 0 dpms/xserver-command=X -s 0 dpms/g’ /etc/lightdm/lightdm.conf

kill -1 $LPID

fi

Add comment

Comments

No comments yet.

Add Comment: