aboutsummaryrefslogtreecommitdiff
path: root/.config/swayrbar/scripts/brightness-status
blob: db93076461e3ed610f79ccf7fc34e33d395848d4 (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\n" $level
fi