useful_scripts/brightness.sh

8 lines
355 B
Bash
Raw Permalink Normal View History

2023-03-24 14:40:17 -03:00
#!/bin/bash
printf "%s" "${1}" | grep "^-\?[0-9.]\+$">/dev/null || exit 1
curval="$(xrandr --verbose | grep -o "Brightness: [0-9.]\+" | grep -o "[0-9.]\+")"
[ $(bc -l <<< "scale=1;${curval}>=0.3") -eq 1 ] &&\
[ $(bc -l <<< "scale=1;${curval}<=2") -eq 1 ]\
&& curval="$(bc -l <<< "scale=1;${curval}+${1}")"
xrandr --output LVDS1 --brightness "${curval}"