From 68562d5d8534da9acea79f040c0a57355f374267 Mon Sep 17 00:00:00 2001 From: Olli Pikarinen Date: Fri, 19 Jan 2018 13:00:04 +0200 Subject: [PATCH] Add util to grok with display backlight brightness --- scripts/brightness | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 scripts/brightness diff --git a/scripts/brightness b/scripts/brightness new file mode 100755 index 0000000..90f4ee5 --- /dev/null +++ b/scripts/brightness @@ -0,0 +1,14 @@ +#!/bin/bash + +: ${1?"Usage: $0 argument"} + +brightness=`cat /sys/class/backlight/intel_backlight/brightness` +max_brightness=`cat /sys/class/backlight/intel_backlight/max_brightness` +new_brightness=`printf %.0f $(echo "$brightness*$1" | bc -l)` + +if [ $new_brightness -gt $max_brightness ] +then + new_brightness=$max_brightness +fi + +echo $new_brightness > /sys/class/backlight/intel_backlight/brightness