summaryrefslogtreecommitdiffhomepage
path: root/xbacklightmon
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-08-14 18:16:08 -0400
committerrealtradam <[email protected]>2023-08-14 18:16:08 -0400
commit440f126691c42e45b7c85e130c0bec9f6a8ab0df (patch)
tree38f04bf592476ef202eb30b6dbfbcae99ff33081 /xbacklightmon
downloadScripts-master.tar.gz
Scripts-master.zip
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