diff --git a/.local/bin/passwords b/.local/bin/passwords index ca0c077a..d583ea82 100644 --- a/.local/bin/passwords +++ b/.local/bin/passwords @@ -3,15 +3,15 @@ totp_tmp="${XDG_CACHE_HOME:-$HOME/.cache}/totp-tmp.png" getPasswords() { - choice="$(find "${PASSWORD_STORE_DIR--~/.password-store}" -type f | sed "s|${PASSWORD_STORE_DIR-~/.password-store}/|| ; s/.gpg$// ; /.gpg-id/d" | sort | grep -v "totp" | dmenu -i -p "Passwords")" + choice="$(find "${PASSWORD_STORE_DIR:-$HOME/.password-store}" -type f | sed "s|${PASSWORD_STORE_DIR:-$HOME/.password-store}/|| ; s/.gpg$// ; /.gpg-id/d" | sort | 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="$(find "${PASSWORD_STORE_DIR--~/.password-store}" -type f | sed "s|${PASSWORD_STORE_DIR-~/.password-store}/|| ; s/.gpg$// ; /.gpg-id/d" | sort | grep "totp" | dmenu -i -p "OTP")" + choice="$(find "${PASSWORD_STORE_DIR:-$HOME/.password-store}" -type f | sed "s|${PASSWORD_STORE_DIR:-$HOME/.password-store}/|| ; s/.gpg$// ; /.gpg-id/d" | sort | grep "totp" | dmenu -i -p "OTP")" [ -z "$choice" ] && exit @@ -62,7 +62,7 @@ addPassword() { } removePassword() { - name="$(find "${PASSWORD_STORE_DIR--~/.password-store}" -type f | sed "s|${PASSWORD_STORE_DIR-~/.password-store}/|| ; s/.gpg$// ; /.gpg-id/d" | sort | dmenu -i -p "Passwords")" + name="$(find "${PASSWORD_STORE_DIR:-$HOME/.password-store}" -type f | sed "s|${PASSWORD_STORE_DIR:-$HOME/.password-store}/|| ; s/.gpg$// ; /.gpg-id/d" | sort | dmenu -i -p "Passwords")" [ -z "$name" ] && exit