Created
April 12, 2013 20:03
-
-
Save seidler2547/5374700 to your computer and use it in GitHub Desktop.
Automatic brightness script for use with ACPI Ambient Light sensor and xbrightness. Other sources of ambient brightness are also possible of course.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ODB=$(xbacklight -get) | |
while : | |
do | |
BR=`cat /sys/class/als/acpi_als0/illuminance` | |
echo -n $BR | |
[ $BR -lt 8 ] && BR=0 | |
DB=`echo "l($BR+1)*l($BR+1)" | bc -l` | |
echo " - $DB" | |
[ $DB != $ODB ] && xbacklight -steps `echo "sqrt(($DB-$ODB)^2)*2+1" | bc | cut -d. -f1` -time `echo "sqrt(($DB-$ODB)^2)*20" | bc | cut -d. -f1` -set $DB% | |
sleep 0.5 | |
ODB=$DB | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment