]> git.friedersdorff.com Git - max/dotfiles.git/blob - sway/.local/bin/lock.magnesium
Prompt to remove yubikey before locking
[max/dotfiles.git] / sway / .local / bin / lock.magnesium
1 #!/bin/sh
2
3 NAG_MSG="Smartcard is still plugged in, not locking! \
4 Lock again to force locking."
5
6 LOCK_CMD="swaylock "
7 LOCK_CMD+=" -i HDMI-A-2:~/Pictures/lockscreen_1080_1.png"
8 LOCK_CMD+=" -i HDMI-A-3:~/Pictures/lockscreen_1080_2.png"
9
10 if [ $(pgrep -c lock.${HOSTNAME}) -gt 1 ]; then
11         pkill -f "$NAG_MSG" 
12         $LOCK_CMD
13 elif gpg --card-status >/dev/null 2&>1; then
14         swaynag -m "$NAG_MSG" --type warning
15 else
16         $LOCK_CMD
17 fi