summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbl12
1 files changed, 9 insertions, 3 deletions
diff --git a/bl b/bl
index 84f14d7..7db821e 100755
--- a/bl
+++ b/bl
@@ -27,6 +27,7 @@ get_bldir() {
exit 1
fi
bldir="$f"
+ BACKLIGHT="${f##*/}"
done
fi
}
@@ -60,6 +61,12 @@ get_brightness() {
raw_curr="$(read_num "$bldir/brightness")"
max=100
curr=$(( (raw_curr + (raw_max / 2 / max)) * max / raw_max ))
+
+ # brightness 0 tends to completely turn off the backlight
+ raw_min=1
+ case "$BACKLIGHT" in
+ nvidia_[0-9]*) raw_min=0 ;; # nvidia_0 at 0 is still not off
+ esac
}
get_raw_new() {
@@ -92,9 +99,8 @@ get_raw_new() {
if [ "$raw_new" -gt "$raw_max" ]; then
raw_new="$raw_max"
fi
- if [ "$raw_new" -le 0 ]; then
- # brightness 0 tends to completely turn off the backlight
- raw_new=1
+ if [ "$raw_new" -lt "$raw_min" ]; then
+ raw_new="$raw_min"
fi
fi
}