aboutsummaryrefslogtreecommitdiffstats
path: root/xorg/.local/usr/bin/xbacklightmon
blob: 39f6b48ad84c8cde856656f07cab205209fdb942 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

path=/sys/class/backlight/acpi_video0

luminance() {
    read -r level < "$path"/actual_brightness
    factor=$((max / 100))
    printf '%d\n' "$((level / factor))"
}

read -r max < "$path"/max_brightness

xbacklight -set "$(luminance)"

inotifywait -me modify --format '' "$path"/actual_brightness | while read; do
    xbacklight -set "$(luminance)"
done