diff options
author | David Runge <dave@sleepmap.de> | 2019-01-01 19:06:07 +0100 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2019-01-01 19:06:07 +0100 |
commit | 324e2d6adff3acc74098b5f1a19e94ba2171917b (patch) | |
tree | d168344ca9dc43d61288f99e9ad793f19cca8321 | |
parent | c87d5e3ec45f1d6b3ee5a72cb6a387186147cb2f (diff) | |
download | dotfiles-324e2d6adff3acc74098b5f1a19e94ba2171917b.tar.gz dotfiles-324e2d6adff3acc74098b5f1a19e94ba2171917b.tar.bz2 dotfiles-324e2d6adff3acc74098b5f1a19e94ba2171917b.tar.xz dotfiles-324e2d6adff3acc74098b5f1a19e94ba2171917b.zip |
bin/backlight: Adding more thorough description. Adding better help printout. Only print help on -h.
Print current brightness in percentage when not giving any parameter.
-rwxr-xr-x | bin/backlight | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bin/backlight b/bin/backlight index ac8a466..be0dadf 100755 --- a/bin/backlight +++ b/bin/backlight @@ -1,5 +1,9 @@ #!/usr/bin/env bash -# set backlight through sysfs +# +# Sets backlight through /sys/class/backlight/intel_backlight/brightness +# Note: This requires the file to be user-writable! +# Changes can be applied either by (positive or negative) relative increment +# [-i] or as an absolute value [-s] (in percentage). set -euo pipefail @@ -70,8 +74,8 @@ set_brightness() { } print_help() { - echo -e "Usage:\n $0 -d <decrement_by_x_percent> \n or $0 -i <increment_by_x_percent>" - exit 1 + echo -e "Usage: $0 [-i <increment_in_percent>] [-s <brightness_in_percent>]" + exit 0 } if [ ${#@} -gt 0 ]; then @@ -93,7 +97,8 @@ if [ ${#@} -gt 0 ]; then esac done else - print_help + echo "$current_brightness_percentage" + exit 0 fi set_brightness |