summaryrefslogtreecommitdiff
path: root/common/bin/brightness.sh
blob: 5cedc6205b80bd972fb52c2dca9ebd655ac3579e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
readonly XBACKLIGHT=xbacklight

current_level=$($XBACKLIGHT)
current_level=$((${current_level%.*}))

if (( "$current_level" < 8 )); then
    diff=1
elif (( "$current_level" < 24 )); then
    diff=6
else
    diff=10
fi

if [[ $1 == "+" ]]; then
    $XBACKLIGHT -inc $diff
elif [[ $1 == "-" ]]; then
    $XBACKLIGHT -dec $diff
else
    echo "Usage: $0 +|-"
    exit 1
fi