Created
August 31, 2015 13:34
-
-
Save atimermann/34f4e52b4a4db64e80a5 to your computer and use it in GitHub Desktop.
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 | |
# /usr/local/bin/brightness | |
# wrapper script to change brightness values | |
# make script executable | |
# constants - edit as required | |
UPPER=4882 | |
LOWER=1 | |
INCREMENT=100 | |
DECREMENT=100 | |
# current value | |
CURRENT=`cat /sys/class/backlight/intel_backlight/brightness` | |
NEW=$CURRENT | |
#if [ $CURRENT -eq 0 ]; then | |
# CURRENT=1; | |
#fi | |
case $1 in | |
up) | |
if [ $(($CURRENTi+$INCREMENT)) -le $UPPER ]; then | |
NEW=$(($CURRENT+$INCREMENT)) | |
fi | |
;; | |
down) | |
if [ $(($CURRENT - $DECREMENT)) -ge $LOWER ]; then | |
NEW=$(($CURRENT - $DECREMENT)) | |
fi | |
;; | |
*) | |
;; | |
esac | |
# set the new brightness value | |
echo $NEW > /sys/class/backlight/intel_backlight/brightness | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment