From: Maximilian Friedersdorff Date: Tue, 14 May 2019 10:38:39 +0000 (+0100) Subject: Prompt to remove yubikey before locking X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=fa9ddad213eb878f4881fa3109b44e65023ee1ca;p=max%2Fdotfiles.git Prompt to remove yubikey before locking --- diff --git a/sway/.local/bin/lock.magnesium b/sway/.local/bin/lock.magnesium index d1db923..6861b9a 100755 --- a/sway/.local/bin/lock.magnesium +++ b/sway/.local/bin/lock.magnesium @@ -1,5 +1,17 @@ #!/bin/sh -swaylock \ - -i HDMI-A-2:~/Pictures/lockscreen_1080_1.png \ - -i HDMI-A-3:~/Pictures/lockscreen_1080_2.png +NAG_MSG="Smartcard is still plugged in, not locking! \ +Lock again to force locking." + +LOCK_CMD="swaylock " +LOCK_CMD+=" -i HDMI-A-2:~/Pictures/lockscreen_1080_1.png" +LOCK_CMD+=" -i HDMI-A-3:~/Pictures/lockscreen_1080_2.png" + +if [ $(pgrep -c lock.${HOSTNAME}) -gt 1 ]; then + pkill -f "$NAG_MSG" + $LOCK_CMD +elif gpg --card-status >/dev/null 2&>1; then + swaynag -m "$NAG_MSG" --type warning +else + $LOCK_CMD +fi