From 324e2d6adff3acc74098b5f1a19e94ba2171917b Mon Sep 17 00:00:00 2001 From: David Runge Date: Tue, 1 Jan 2019 19:06:07 +0100 Subject: 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. --- bin/backlight | 13 +++++++++---- 1 file 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 \n or $0 -i " - exit 1 + echo -e "Usage: $0 [-i ] [-s ]" + 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 -- cgit v1.2.3-70-g09d2