From: Maximilian Friedersdorff Date: Tue, 14 May 2019 11:54:45 +0000 (+0100) Subject: Test for ret status of 2 with gpg --card-status X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=95ed02d396729000c17752ca9084d3f705da0f94;hp=fa9ddad213eb878f4881fa3109b44e65023ee1ca;p=max%2Fdotfiles.git Test for ret status of 2 with gpg --card-status Bourne shell seems to only accept 1 as truthy --- diff --git a/sway/.local/bin/lock.magnesium b/sway/.local/bin/lock.magnesium index 6861b9a..b7cbe89 100755 --- a/sway/.local/bin/lock.magnesium +++ b/sway/.local/bin/lock.magnesium @@ -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