misc/scripts/brightness

28 lines
421 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
2019-01-26 18:51:26 +01:00
current=$(cat /sys/class/backlight/intel_backlight/brightness)
2018-08-05 18:53:07 +02:00
2019-01-26 18:51:26 +01:00
if test -z "$1"; then
echo $current
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
2019-01-26 18:51:26 +01:00
new=$(("$current" "$1" "$2"))
;;
*)
echo "invalid argument '$1'"
exit 1
;;
esac
echo "current: $new"
echo $new > /sys/class/backlight/intel_backlight/brightness