handler.sh 1.79 KB
Newer Older
1
#!/bin/bash
2 3 4 5 6
# Default acpi script that takes an entry for all actions

case "$1" in
    button/power)
        case "$2" in
7 8 9 10 11 12
            PBTN|PWRF)
                logger 'PowerButton pressed'
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
13 14 15 16
        esac
        ;;
    button/sleep)
        case "$2" in
17 18 19 20 21 22
            SLPB|SBTN)
                logger 'SleepButton pressed'
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
23 24 25 26
        esac
        ;;
    ac_adapter)
        case "$2" in
27
            AC|ACAD|ADP0)
28 29
                case "$4" in
                    00000000)
30 31
                        logger 'AC unpluged'
                        ;;
32
                    00000001)
33 34
                        logger 'AC pluged'
                        ;;
35 36
                esac
                ;;
37 38 39
            *)
                logger "ACPI action undefined: $2"
                ;;
40 41 42 43 44 45
        esac
        ;;
    battery)
        case "$2" in
            BAT0)
                case "$4" in
46 47 48 49 50 51
                    00000000)
                        logger 'Battery online'
                        ;;
                    00000001)
                        logger 'Battery offline'
                        ;;
52 53
                esac
                ;;
54
            CPU0)
55 56 57 58 59
                ;;
            *)  logger "ACPI action undefined: $2" ;;
        esac
        ;;
    button/lid)
60 61 62 63 64 65 66 67 68 69 70 71
        case "$3" in
            close)
                logger 'LID closed'
                ;;
            open)
                logger 'LID opened'
                ;;
            *)
                logger "ACPI action undefined: $3"
                ;;
    esac
    ;;
72 73 74 75
    *)
        logger "ACPI group/action undefined: $1 / $2"
        ;;
esac
76 77

# vim:set ts=4 sw=4 ft=sh et: