aboutsummaryrefslogtreecommitdiff
path: root/.config/swayrbar/scripts/brightness-status
blob: 4e03a9ae8f9d36eec158ad8e4a787e29e31a338e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env sh

brightness="$(cat /sys/class/backlight/*/brightness)"
brightness_max="$(cat /sys/class/backlight/*/max_brightness)"

if [ -n "${brightness}" ] && [ -n "${brightness_max}" ]
then
	level=$(echo "scale=2; $brightness / $brightness_max * 100" | bc)

	printf "  "
	printf "%.0f" $level
fi