From 440f126691c42e45b7c85e130c0bec9f6a8ab0df Mon Sep 17 00:00:00 2001 From: realtradam Date: Mon, 14 Aug 2023 18:16:08 -0400 Subject: init --- xbacklightmon | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 xbacklightmon (limited to 'xbacklightmon') 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 -- cgit v1.2.3