summaryrefslogtreecommitdiff
path: root/.config/i3/extra/lidlock
blob: 8ab46d1c946f2040f9494a9a05ab856e4407d1cb (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 5
done