aboutsummaryrefslogtreecommitdiff
path: root/brightness.sh
blob: b104d22602f77f4fca46484c6e0eac7c497e3c23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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