aboutsummaryrefslogtreecommitdiff
path: root/local/bin/backlight-ctl
blob: 48e51c42b02b8b2b938e855cc773ba328331005a (plain)
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
#!/bin/sh

[ "$#" -ne 1 ] && exit 1;


if [ "$(cat /etc/hostname)" = manjaro ]
then
    cmd=light
    up_opt=-A
    down_opt=-U
else
    cmd=xbacklight
    up_opt=-inc
    down_opt=-dec
fi

case "$1" in
    "up")   "$cmd" "$up_opt"   5 ;;
    "down") "$cmd" "$down_opt" 5 ;;
    *)      exit 1 ;;
esac

value="$("$cmd" | cut -d '.' -f 1)"

notify-send --hint=int:transient:1 --hint=int:value:"$value" "Backlight"