#!/bin/sh totp_tmp="${XDG_CACHE_HOME:-$HOME/.cache}/totp-tmp.png" getPasswords() { choice="$(pass | sed -E "1d;s/(└|├|─|─ )//g" | grep -v "totp" | dmenu -i -p "Passwords")" [ -z "$choice" ] && exit pass -c "$choice" && notify-send "📋 Password for $choice copied!" || notify-send "⚠️ Something went wrong. Make sure you have initialized pass" } getTOTP() { choice="$(pass | sed -E "1d;s/(└|├|─|─ )//g" | grep "totp" | dmenu -i -p "OTP")" [ -z "$choice" ] && exit pass otp -c "$choice" && notify-send "⏲️ OTP for $choice copied!" || notify-send "⚠️ Something went wrong. Make sure you have installed pass-totp" } addTOTP() { ifinstalled zbarimg || exit name=$(printf "" | dmenu -i -p "What is the account name?") [ -z "$name" ] && exit notify-send "📷 Please screenshot the QR code" maim -m 10 -d 0.1 -s "$totp_tmp" zbarimg -q --raw "$totp_tmp" | pass otp insert totp-"$name" && notify-send "🔒 OTP for totp-$name added!" || notify-send "❌ Failed to add QR code!" rm "$totp_tmp" } addPassword() { name=$(printf "" | dmenu -i -p "What is the account name?") [ -z "$name" ] && exit case "$(printf "Random password\\nManual password" | dmenu -i -p "Passwords")" in "Random password") case "$(printf "Simple\\nComplex" | dmenu -i -p "Passwords")" in "Simple") addPass=$(tr -dc 'A-Za-z0-9' ?@[\]^_`{|}~'