aboutsummaryrefslogtreecommitdiff
path: root/my-x200.sh
blob: 1cd3b063f24d52a3f8460f598e99ba1ba7ed5632 (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
#!/bin/bash
# Default acpi script that takes an entry for all actions

case "$1" in
    button/sleep)
        case "$2" in
            SLPB|SBTN)
                logger 'SleepButton pressed'
		/bin/loginctl suspend
		rc-service my-x200 restart
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
        esac
        ;;
    button/suspend)
	case "$2" in
	    SUSP)
		logger 'SuspendButton pressed'
		/bin/loginctl sleep
		rc-service my-x200 restart
		;;
	    *)
		logger "ACPI action undefined: $2"
		;;
	esac
	;;
    button/lid)
        case "$3" in
            close)
		/bin/loginctl suspend
                logger 'LID closed'
                ;;
            open)
                logger 'LID opened'
		rc-service my-x200 restart
                ;;
            *)
                logger "ACPI action undefined: $3"
                ;;
        esac
        ;;
esac