nixos-configs/config/eww/scripts/brightness.sh

47 lines
743 B
Bash
Raw Normal View History

#!/usr/bin/env bash
get_icon () {
val=$(brightnessctl get)
if [ "$val" -le 3 ]; then
eww update br_icon=" "
elif [ "$val" -le 38 ]; then
eww update br_icon=" "
2023-07-30 22:15:44 -04:00
elif [ "$val" -le 77 ]; then
eww update br_icon=" "
elif [ "$val" -le 115 ]; then
eww update br_icon=" "
elif [ "$val" -le 153 ]; then
eww update br_icon=" "
elif [ "$val" -le 191 ]; then
eww update br_icon=" "
elif [ "$val" -le 230 ]; then
eww update br_icon=" "
else
eww update br_icon=" "
fi
}
if [[ $1 == "br" ]]; then
brightnessctl get
fi
if [[ $1 == "icon" ]]; then
2023-07-30 22:15:44 -04:00
while true; do
get_icon
2023-08-20 11:44:31 -04:00
sleep 1
2023-07-30 22:15:44 -04:00
done
fi
if [[ $1 == "set" ]]; then
brightnessctl set "$2"
get_icon
fi