summaryrefslogtreecommitdiffstats
path: root/screen-locker.sh
blob: b1fb59434617dd972f3bd1078c4a34a79a1a1b3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

lock="$HOME/.screen-locker.lck"
exec 9>"${lock}"
if ! flock -n 9; then
	logger "screen locker lock already locked"
	exit
fi

if pidof i3lock &> /dev/null; then exit 1; fi

revert() {
	xset dpms 0 0 0
	logger "unlocking screen"
}
trap revert SIGHUP SIGINT SIGTERM EXIT
xset +dpms dpms 10 10 10

xset dpms force off
logger "locking screen"
i3lock -n -c 000000