diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2015-10-10 19:07:10 -0400 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2015-10-10 19:07:10 -0400 |
commit | 0eb5cc3deb96e657b581e495bf6c53b421c16ca1 (patch) | |
tree | 25053d1e3d94074476cd8607626acccbe8029f82 | |
parent | 55e42679b93cb40fa01354a5feaeb1f1038b8782 (diff) |
Script to set brightness with a scaling factor.
-rwxr-xr-x | bin/brightness.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bin/brightness.sh b/bin/brightness.sh new file mode 100755 index 0000000..5a1939e --- /dev/null +++ b/bin/brightness.sh @@ -0,0 +1,25 @@ +#!/bin/bash +readonly XBACKLIGHT=xbacklight +readonly levels=(0 1 2 3 4 6 10 15 20 25 30 40 50 60 70 80 90 100) + +current_level=$($XBACKLIGHT) +current_level=$((${current_level%.*})) + +if (( "$current_level" < 8 )); then + diff=1 +elif (( "$current_level" < 24 )); then + diff=6 +elif (( "$current_level" < 50 )); then + diff=12 +else + diff=24 +fi + +if [[ $1 == "+" ]]; then + $XBACKLIGHT -inc $diff +elif [[ $1 == "-" ]]; then + $XBACKLIGHT -dec $diff +else + echo "Usage: $0 +|-" + exit 1 +fi |