summaryrefslogtreecommitdiff
path: root/bl
blob: 898faee831e5792705141f982d70f4ce2403f166 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh

## Backlight controller generic: use either light or xbacklight

CMD=`crcparse bl`

case "$CMD" in
  "light")
    case "$1" in
      "-i")
        light -A "${2:-1%}"
        ;;
      "-d")
        light -U "${2:-1%}"
        ;;
      "-s")
        light -S "$2"
        ;;
      "-g"|"")
        light -G
        ;;
      "*")
        printf "$CMD: $1 not understood. Treating it as a direct command."
        light "$@"
        ;;
    esac
    ;;
  "xbacklight")
    case "$1" in
      "-i")
        xbacklight -inc "${2:-1}"
        ;;
      "-d")
        xbacklight -dec "${2:-1}"
        ;;
      "-s")
        xbacklight -set "$2"
        ;;
      "-g"|"")
        xbacklight -get
        ;;
      "*")
        printf "$CMD: $1 not understood. Treating it as a direct command."
        xbacklight "$@"
        ;;
    esac
esac