mirror of
https://github.com/pgrondek/config.git
synced 2024-11-22 12:03:43 +00:00
32 lines
625 B
Bash
Executable File
32 lines
625 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
output=eDP-1
|
|
brightness=?
|
|
|
|
get_brighntess() {
|
|
brightness=$(xrandr --verbose | grep -m 1 Brightness | awk '{printf "%d", $2*100}')
|
|
}
|
|
|
|
set_brightness() {
|
|
brightness=$1
|
|
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}' )
|
|
}
|
|
|
|
get_brighntess
|
|
|
|
case $BLOCK_BUTTON in
|
|
4) set_brightness $((brightness + 10 ))
|
|
;; # scroll up
|
|
|
|
5) set_brightness $((brightness - 10 ))
|
|
;; # scroll down
|
|
esac
|
|
|
|
echo $brightness
|