From 1746ea2749f651da0423bfe637cddf0c22df831a Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Wed, 23 Nov 2016 21:36:19 +0100 Subject: Updated dotfiles --- xorg/.local/share/systemd/user/xbacklightmon.service | 8 ++++++++ xorg/.local/usr/bin/xbacklightmon | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 xorg/.local/share/systemd/user/xbacklightmon.service create mode 100755 xorg/.local/usr/bin/xbacklightmon (limited to 'xorg') diff --git a/xorg/.local/share/systemd/user/xbacklightmon.service b/xorg/.local/share/systemd/user/xbacklightmon.service new file mode 100644 index 0000000..c603974 --- /dev/null +++ b/xorg/.local/share/systemd/user/xbacklightmon.service @@ -0,0 +1,8 @@ +[Unit] +Description=Watches /sys/class/backlight/brightness and applies it to xorg-backlight +After=graphical.target +Wants=graphical.target + +[Service] +Type=simple +ExecStart=/home/tom/.local/usr/bin/xbacklightmon 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 @@ +#!/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 -- cgit v1.2.3