diff options
-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 |