diff options
Diffstat (limited to 'util')
| -rwxr-xr-x | util/backlight.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/util/backlight.sh b/util/backlight.sh new file mode 100755 index 0000000..15a8423 --- /dev/null +++ b/util/backlight.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -x +set -e +# Note the trailing slash +# base="/sys/class/backlight/amdgpu_bl0/" +base="/sys/class/backlight/intel_backlight/" + +percent="$1"; shift +_backlight="${base}brightness" +_max="${base}max_brightness" + +# Since `bc` is often not installed by default, just use awk +_max="$(awk '{print $1/100;}' "$_max")" +percent="$(echo "${percent}" | awk '{print int($1*'"$_max"');}')" + +echo $percent + + +sudo sh -c "echo \"$percent\" > $_backlight" |
