summaryrefslogtreecommitdiffhomepage
path: root/xbacklightmon
diff options
context:
space:
mode:
Diffstat (limited to 'xbacklightmon')
-rwxr-xr-xxbacklightmon17
1 files changed, 17 insertions, 0 deletions
diff --git a/xbacklightmon b/xbacklightmon
new file mode 100755
index 0000000..5120fbf
--- /dev/null
+++ b/xbacklightmon
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+path=/sys/class/backlight/acpi_video0
+
+luminance() {
+ read -r level < "$path"/actual_brightness
+ factor=$((100 / max))
+ 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