blob: 562ee62f0422a39c7a6baa5fd114d39ddde6aed9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/usr/bin/env sh
brightness_path=/sys/class/backlight/*/brightness
brightness_max_path=/sys/class/backlight/*/max_brightness
if [ -f "${brightness_path}" ]
then
brightness="$(cat $brightness_path)"
fi
if [ -f "${brightness_max_path}" ]
then
brightness_max="$(cat /sys/class/backlight/*/max_brightness)"
fi
if [ -n "${brightness}" ] && [ -n "${brightness_max}" ]
then
level=$(echo "scale=2; $brightness / $brightness_max * 100" | bc)
printf " "
printf "%.0f\n" $level
fi
|