#!/bin/sh
ob=""
while true
do
# must use "Dim Display" control for this to work
br=$(qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement \
org.kde.Solid.PowerManagement.brightness)
# if new and old values differ
if [ "$br" != "$ob" ]
then
# if brightness is below a threshold value
if [ $br -le 15 ]
then
vbetool dpms off > /dev/null 2>&1
else
vbetool dpms on > /dev/null 2>&1
fi
ob=$br
fi
sleep 2
done