diff options
Diffstat (limited to 'home/xyz/.local')
-rwxr-xr-x | home/xyz/.local/bin/backlight | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/home/xyz/.local/bin/backlight b/home/xyz/.local/bin/backlight index 4e1a516e..3de87f56 100755 --- a/home/xyz/.local/bin/backlight +++ b/home/xyz/.local/bin/backlight @@ -1,26 +1,23 @@ #!/bin/sh -# adjust backlight brightness=$(cat /sys/class/backlight/intel_backlight/brightness) max_brightness=$(cat /sys/class/backlight/intel_backlight/max_brightness) step=$((max_brightness/20)) -while getopts ud opt; do - case $opt in - u) - case "$brightness" in - 0) echo 1;; - 1) echo "$step";; - *) echo "$((brightness+step))";; - esac - ;; - d) - case "$brightness" in - 1) echo 0;; - "$step") echo 1;; - *) echo "$((brightness-step))";; - esac - ;; - \?) exit 1;; - esac -done > /sys/class/backlight/intel_backlight/brightness +case "$1" in + '-u') + case "$brightness" in + 0) echo 1;; + 1) echo "$step";; + *) echo "$((brightness+step))";; + esac + ;; + '-d') + case "$brightness" in + 1) echo 0;; + "$step") echo 1;; + *) echo "$((brightness-step))";; + esac + ;; + *) exit 1;; +esac > /sys/class/backlight/intel_backlight/brightness |