2019-05-28 12:01:09 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
output=eDP-1
|
2019-11-07 09:41:13 +00:00
|
|
|
brightness=?
|
2019-05-28 12:01:09 +00:00
|
|
|
|
2019-11-07 09:41:13 +00:00
|
|
|
get_brighntess() {
|
2019-11-14 10:51:15 +00:00
|
|
|
brightness=$(xrandr --verbose | grep -m 1 Brightness | awk '{printf "%d", $2*100}')
|
2019-11-07 09:41:13 +00:00
|
|
|
}
|
|
|
|
|
2019-05-28 12:01:09 +00:00
|
|
|
set_brightness() {
|
2019-11-12 07:33:44 +00:00
|
|
|
brightness=$1
|
2020-02-13 12:18:32 +00:00
|
|
|
if [ "$brightness" -gt 100 ]; then
|
|
|
|
brightness=100
|
|
|
|
fi
|
|
|
|
if [ "$brightness" -lt 0 ]; then
|
|
|
|
brightness=0
|
|
|
|
fi
|
|
|
|
xrandr --output $output --brightness $(echo $brightness | awk '{printf "%0.2f", $1/100}' )
|
2019-05-28 12:01:09 +00:00
|
|
|
}
|
|
|
|
|
2019-11-07 09:41:13 +00:00
|
|
|
get_brighntess
|
|
|
|
|
2019-05-28 12:01:09 +00:00
|
|
|
case $BLOCK_BUTTON in
|
|
|
|
4) set_brightness $((brightness + 10 ))
|
|
|
|
;; # scroll up
|
|
|
|
|
|
|
|
5) set_brightness $((brightness - 10 ))
|
|
|
|
;; # scroll down
|
|
|
|
esac
|
2019-11-07 09:41:13 +00:00
|
|
|
|
2019-11-12 07:33:44 +00:00
|
|
|
echo $brightness
|