dotfiles/.local/bin/tools/bright

9 lines
409 B
Plaintext
Raw Normal View History

2020-07-04 14:23:27 +02:00
#!/bin/bash
case $1 in
"set") printf %0.f $( echo "scale=0; $2 * 9.37" | bc -l ) > /sys/class/backlight/intel_backlight/brightness;;
"add") current=$( </sys/class/backlight/intel_backlight/brightness )
new=$( printf %.0f $(echo "$current + $2 * 9.37" | bc -l ) )
[ $new -gt 936 ] && bright set 937 || ( [ $new -lt 0 ] && bright set 0 || bright set "$(( new + 1 ))" ) ;;
"del") bright add "-$2";;
esac