diff options
Diffstat (limited to 'xorg/.local/usr/bin/xbacklightmon')
| -rwxr-xr-x | xorg/.local/usr/bin/xbacklightmon | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/xorg/.local/usr/bin/xbacklightmon b/xorg/.local/usr/bin/xbacklightmon new file mode 100755 index 0000000..39f6b48 --- /dev/null +++ b/xorg/.local/usr/bin/xbacklightmon | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | path=/sys/class/backlight/acpi_video0 | ||
| 4 | |||
| 5 | luminance() { | ||
| 6 | read -r level < "$path"/actual_brightness | ||
| 7 | factor=$((max / 100)) | ||
| 8 | printf '%d\n' "$((level / factor))" | ||
| 9 | } | ||
| 10 | |||
| 11 | read -r max < "$path"/max_brightness | ||
| 12 | |||
| 13 | xbacklight -set "$(luminance)" | ||
| 14 | |||
| 15 | inotifywait -me modify --format '' "$path"/actual_brightness | while read; do | ||
| 16 | xbacklight -set "$(luminance)" | ||
| 17 | done | ||
