diff --git a/i3/i3blocks/blocks/brightness b/i3/i3blocks/blocks/brightness index 228b517..47efe27 100755 --- a/i3/i3blocks/blocks/brightness +++ b/i3/i3blocks/blocks/brightness @@ -8,8 +8,14 @@ get_brighntess() { } set_brightness() { - xrandr --output $output --brightness $(echo $1 | awk '{printf "%0.2f", $1/100}' ) 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