diff options
Diffstat (limited to 'brightness.sh')
-rw-r--r-- | brightness.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/brightness.sh b/brightness.sh new file mode 100644 index 0000000..b104d22 --- /dev/null +++ b/brightness.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +brightness_file=/sys/class/backlight/intel_backlight/brightness +maxbrightness_file=/sys/class/backlight/intel_backlight/max_brightness + +brightness=$(< $brightness_file) +maxbrightness=$(< $maxbrightness_file) +let target=$1+$brightness +#for testing: +#echo "Actual bright: $brightness; Max: $maxbrightness; Target: $target" +if [ $target -gt $maxbrightness ] +then + echo "Value too big. Target: $target; max: $maxbrightness" +elif [ 0 -gt $target ] +then + echo "Value too low. Target: $target" +else + echo $target | tee $brightness_file + echo "New brightness: $target/$maxbrightness" +fi |