diff options
author | clsr <clsr@clsr.net> | 2020-06-19 22:56:19 +0200 |
---|---|---|
committer | clsr <clsr@clsr.net> | 2020-06-19 22:56:19 +0200 |
commit | f56cce2e20ac5f31981b5a0adb606f277ddb675b (patch) | |
tree | c63bf22e3d3bfea1bea6cf22f3857a41618a48ba | |
parent | d8fdc47628e4fda11c18a704b075b9a9cdc4cb95 (diff) | |
download | bl-f56cce2e20ac5f31981b5a0adb606f277ddb675b.tar.gz bl-f56cce2e20ac5f31981b5a0adb606f277ddb675b.zip |
Add raw_min special case for nvidia backlight
-rwxr-xr-x | bl | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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 } |