diff --git a/.local/bin/passwords b/.local/bin/passwords index 7fcd81ce..6625e2ef 100644 --- a/.local/bin/passwords +++ b/.local/bin/passwords @@ -28,6 +28,19 @@ getTOTP() { \ fi } +addTOTP() { \ + name=$(printf "" | dmenu -i -p "What is the account name?") + if [ "$name" != "" ] + then + notify-send "📷 Please screenshot the QR code" + maim -m 10 -d 0.1 -s ~/.cache/totp-tmp.png + zbarimg -q --raw ~/.cache/totp-tmp.png | pass otp insert totp-$name + notify-send " OTP for totp-$name added!" + rm ~/.cache/totp-tmp.png + fi + unset name +} + addPassword() { \ name=$(printf "" | dmenu -i -p "What is the account name?") if [ "$name" != "" ] @@ -45,7 +58,7 @@ addPassword() { \ removePassword() { \ name="$(pass | sed -r '1d;s/^├.{3}//;s/^└.{3}//' | dmenu -i -p "Passwords")" - sure="$(printf "No\\nYes" | dmenu -i -sb "#ac3333" -sf "#1d2021" -nf "#bbbbbb" -nb "#111111" -p "Are you sure?")" + sure="$(printf "No\\nYes" | dmenu -i -sb "#ac3333" -sf "#111111" -nf "#dddddd" -nb "#111111" -p "Are you sure?")" if [ $sure = "Yes" ] then notify-send " Password for $name removed!" @@ -56,9 +69,10 @@ removePassword() { \ unset name } -case "$(printf "Add password\\nRemove password\\nView password\\nView TOTP" | dmenu -i -p "Passwords")" in +case "$(printf "Add password\\nView password\\nView TOTP\\nAdd TOTP\\nRemove password" | dmenu -i -p "Passwords")" in "Add password") addPassword ;; - "Remove password") removePassword ;; "View password") getPasswords ;; + "Add TOTP") addTOTP ;; "View TOTP") getTOTP ;; + "Remove password") removePassword ;; esac