blob: d18e58cdd3ca86b381080eb8a8013a0fe258dd09 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/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
|