summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2020-08-07 09:45:02 +0200
committerclsr <clsr@clsr.net>2020-08-07 09:45:02 +0200
commit4dcfff1e04ad38f36ba14ee68f4477f88ff3b227 (patch)
treee41ec0a3161148b059924cfe3c184d75a314cd39
parentdd26c2292ec7ca5385c99738f390ee7015451c4a (diff)
downloadbl-4dcfff1e04ad38f36ba14ee68f4477f88ff3b227.tar.gz
bl-4dcfff1e04ad38f36ba14ee68f4477f88ff3b227.zip
Ensure that increment or decrement changes raw backlight value
-rwxr-xr-xbl5
1 files changed, 5 insertions, 0 deletions
diff --git a/bl b/bl
index c928519..d66422b 100755
--- a/bl
+++ b/bl
@@ -121,6 +121,11 @@ get_raw_new() {
esac
if [ -n "$new" ]; then
: $(( raw_new = new * raw_max / max ))
+ if [ "$new" -lt "$curr" ] && [ "$raw_new" -ge "$raw_curr" ]; then
+ : $(( raw_new = raw_curr - 1 ))
+ elif [ "$new" -gt "$curr" ] && [ "$raw_new" -le "$raw_curr" ]; then
+ : $(( raw_new = raw_curr + 1 ))
+ fi
fi
if [ -n "$raw_new" ]; then
if [ "$raw_new" -gt "$raw_max" ]; then