3 if [ "$(id -u)" != "0" ]; then
7 MAX=$(cat /sys/class/backlight/intel_backlight/max_brightness)
8 CURRENT=$(cat /sys/class/backlight/intel_backlight/brightness)
10 ADJ=$(( $MAX / ${2:-20} ))
12 if [ "$1" == "max" ]; then
14 elif [ "$1" == "off" ]; then
16 elif [ "$1" == "min" ]; then
18 elif [ "$1" == "dec" ]; then
19 NEW=$(( $CURRENT - $ADJ < 1 ? 1 : $CURRENT - $ADJ ))
20 elif echo "$1" | grep -q '^[[:digit:]][[:digit:]]*\%*$'; then
21 NEW=$(( $(echo "$1" | sed 's/\%//') * $MAX / 100 ))
23 NEW=$(( $CURRENT + $ADJ >= $MAX ? $MAX : $CURRENT + $ADJ ))
26 echo $NEW > /sys/class/backlight/intel_backlight/brightness