misc/scripts/brightness

28 lines
412 B
Plaintext
Raw Normal View History

2018-08-05 18:53:07 +02:00
#!/bin/sh
2019-01-26 18:51:26 +01:00
# set backlight brightness level
2018-08-05 18:53:07 +02:00
2023-02-05 02:08:04 +01:00
current=$(cat /sys/class/backlight/acpi_video0/brightness)
2018-08-05 18:53:07 +02:00
2019-01-26 18:51:26 +01:00
if test -z "$1"; then
2020-07-25 17:38:45 +02:00
echo "$current"
2019-01-26 18:51:26 +01:00
exit 0
fi
2018-08-05 18:53:07 +02:00
2019-01-26 18:51:26 +01:00
case "$1" in
'+' | '-')
if test -z "$2"; then
echo "missing increment"
exit 1
2018-08-05 18:53:07 +02:00
fi
2020-07-25 17:38:45 +02:00
new="$((current $1 $2))"
2019-01-26 18:51:26 +01:00
;;
*)
echo "invalid argument '$1'"
exit 1
;;
esac
echo "current: $new"
2023-02-05 02:08:04 +01:00
echo "$new" > /sys/class/backlight/acpi_video0/brightness