From fcbfec425a5d2ff66e1ce931e86bf2d3dc062128 Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Wed, 13 Jul 2022 00:25:58 +0930 Subject: [PATCH] updated mod_backlight to use brillo for better backlight control --- scripts/mod_backlight | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/scripts/mod_backlight b/scripts/mod_backlight index 116b7c7..aca3460 100755 --- a/scripts/mod_backlight +++ b/scripts/mod_backlight @@ -1,5 +1,19 @@ #!/bin/bash -if command -v backlight_control &> /dev/null; then - backlight_control $1 -fi \ No newline at end of file +if command -v brillo &> /dev/null; then + function send_notification() { + brightness=$(printf "%.0f\n" $(brillo -G)) + dunstify -a "changebrightness" -u low -r 9991 -h int:value:"$brightness" -i "brightness-$1" "Brightness: $brightness%" -t 2000 +} + + case $1 in + up) + brillo -A 5 -q -u 150000 + send_notification $1 + ;; + down) + brillo -U 5 -q -u 150000 + send_notification $1 + ;; + esac +fi