ark/users/modules/eww/scripts/brightness
2022-09-14 15:35:52 +03:00

14 lines
376 B
Bash
Executable File

#!/usr/bin/env bash
icons=("" "" "")
# initial
icon=${icons[$(awk -v n="$(light)" 'BEGIN{print int(n/34)}')]}
echo '{ "level": '"$(light)"', "icon": "'"$icon"'" }'
udevadm monitor | rg --line-buffered "backlight" | while read -r _; do
icon="${icons[$(awk -v n="$(light)" 'BEGIN{print int(n/34)}')]}"
echo '{ "level": '"$(light)"', "icon": "'"$icon"'" }'
done