diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2019-12-05 21:59:17 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2019-12-05 21:59:17 -0500 |
| commit | 701126f58307ebd4918b26ce705f3b5793741f36 (patch) | |
| tree | ce8515b9e5892ec1d50e4f952856d9f00fe42efa /util | |
| parent | d70dc75744485fb69768b8c3f012ee0aa074a469 (diff) | |
| download | dotfiles-701126f58307ebd4918b26ce705f3b5793741f36.tar.gz dotfiles-701126f58307ebd4918b26ce705f3b5793741f36.tar.xz | |
Add my backlight shell script
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" |
