blob: 553b79a72466c1e306aac3b1f200177d00f2a0ee (
plain) (
tree)
|
|
#!/bin/bash
device=$(find /sys/class/backlight/* -maxdepth 1 | head -n 1)
max=$(cat "$device/max_brightness")
current=$(cat "$device/brightness")
step=20
case "$1" in
get)
echo "$current"
;;
dec)
if [[ "$current" -gt 0 ]]; then
echo $(( current - step )) > "$device/brightness"
fi
;;
inc)
if [[ "$current" -lt "$max" ]]; then
echo $(( current + step )) > "$device/brightness"
fi
;;
*)
echo "Unknown argument $1" >&2
exit 1
;;
esac
|