]> git.friedersdorff.com Git - max/dotfiles.git/commitdiff
Test for ret status of 2 with gpg --card-status
authorMaximilian Friedersdorff <max@friedersdorff.com>
Tue, 14 May 2019 11:54:45 +0000 (12:54 +0100)
committerMaximilian Friedersdorff <max@friedersdorff.com>
Tue, 14 May 2019 11:54:45 +0000 (12:54 +0100)
Bourne shell seems to only accept 1 as truthy

sway/.local/bin/lock.magnesium

index 6861b9aa17da01278a35d1967ba11890347dd8c8..b7cbe89dd178be35fd30ec1cee1b522785347f61 100755 (executable)
@@ -10,8 +10,13 @@ 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
+       gpg --card-status > /dev/null
+       if [ $? -ne 2 ]; then
+               gpg --card-status
+               echo $?
+               swaynag -m "$NAG_MSG" --type warning
+       else
+               $LOCK_CMD
+       fi
 fi