rely on max_brightness instead
This commit is contained in:
parent
fd35c75289
commit
02eb57b446
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -euf
|
||||
|
||||
BACKLIGHT_PATH="${BACKLIGHT_PATH:-/sys/class/backlight/amdgpu_bl0/brightness}"
|
||||
BACKLIGHT_PATH="${BACKLIGHT_PATH:-/sys/class/backlight/amdgpu_bl0}"
|
||||
|
||||
errecho() {
|
||||
>&2 printf '%s\n' "$*"
|
||||
|
@ -22,7 +22,8 @@ If -s and -c are specified, -c takes priority
|
|||
|
||||
q=
|
||||
nb=
|
||||
cb="$(cat "$BACKLIGHT_PATH")"
|
||||
mb="$(cat "$BACKLIGHT_PATH/max_brightness")"
|
||||
cb="$(cat "$BACKLIGHT_PATH/brightness")"
|
||||
while getopts :hqs:c: OPT; do
|
||||
case $OPT in
|
||||
h) usage ;;
|
||||
|
@ -36,7 +37,7 @@ done
|
|||
errecho "Current brightness: $cb"
|
||||
|
||||
[ -z "$nb" ] && errecho "Brightness not changed" && exit 0
|
||||
[ "$nb" -gt 255 ] && nb=255
|
||||
[ "$nb" -gt "$mb" ] && nb=255
|
||||
[ "$nb" -lt 0 ] && nb=0
|
||||
|
||||
printf '%s' "$nb" > "$BACKLIGHT_PATH" && errecho "New brightness: $nb" || errecho "Error setting brightness!"
|
||||
printf '%s' "$nb" > "$BACKLIGHT_PATH/brightness" && errecho "New brightness: $nb" || errecho "Error setting brightness!"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
A simple script to change the backlight brightness value on laptops. Mostly made as a workaround for [this bug](https://bugzilla.kernel.org/show_bug.cgi?id=203905).
|
||||
|
||||
## Configuration
|
||||
The only configurable variable is the backlight path. It defaults to `/sys/class/backlight/amdgpu_bl0/brightness`. You can change `BACKLIGHT_PATH` to point to the file path.
|
||||
The only configurable variable is the backlight path. It defaults to `/sys/class/backlight/amdgpu_bl0`. You can change `BACKLIGHT_PATH` to point to the file path.
|
||||
|
||||
## Usage
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue