summaryrefslogtreecommitdiff
path: root/.config/i3/extra/lidlock
blob: 81b3b49e0b587353fea337a5a87addc2d7bbb4b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/sh

get_state() {
    echo $(cat /proc/acpi/button/lid/LID0/state)
}

OLD_STATE=$(get_state)

while :
do
    CUR_STATE=$(get_state)

    if [ "$CUR_STATE" != "$OLD_STATE" ]; then
        if echo $CUR_STATE | grep closed; then
            betterlockscreen -l
        fi
    fi

    OLD_STATE=$CUR_STATE
    sleep 1
done