1
0
mirror of https://github.com/pgrondek/config.git synced 2024-12-01 15:53:53 +00:00
config/i3/i3blocks/blocks/brightness
2019-11-07 10:41:13 +01:00

30 lines
523 B
Bash
Executable File

#!/usr/bin/env bash
output=eDP-1
brightness=?
get_brighntess() {
brightness=$(xrandr --verbose | grep Brightness | awk '{printf "%d", $2*100}')
}
print_bringtness() {
get_brighntess
echo $brightness
}
set_brightness() {
xrandr --output $output --brightness $(echo $1 | 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
print_bringtness