]> git.friedersdorff.com Git - max/saltfiles.git/blob - states/sway/files/lock
Run zoom on startup
[max/saltfiles.git] / states / sway / files / lock
1 #!/bin/sh
2
3 NAG_MSG="Smartcard is still plugged in, not locking! \
4 Remove now to lock."
5 NOLOCK_MSG="Smartcard was not removed, did not lock!"
6
7 gpg --card-status > /dev/null
8 if [ $? -ne 2 ]; then
9         swaynag -m "$NAG_MSG" --type warning&
10
11         counter=0
12         while [ $? -ne 2 ]; do
13                 if [ $counter -gt 20 ]; then
14                         pkill -f "$NAG_MSG"
15                         swaynag -m "$NOLOCK_MSG" --type error&
16                         exit
17                 fi
18
19                 sleep 1
20                 counter=$(bc <<<"${counter}+1")
21                 gpg --card-status > /dev/null
22         done
23         pkill -f "$NAG_MSG"
24 fi
25 pkill -u ${UID} swayidle --signal USR1