Only notify when successfully copying password

This commit is contained in:
krisdoodle45 2021-11-21 16:15:56 +01:00 committed by GitHub
parent 039f6147b6
commit bb755b367b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ shopt -s nullglob globstar
totp_tmp="${XDG_CACHE_HOME:-$HOME/.cache}/totp-tmp.png"
passwordList() { \
passwordList() {
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=("$prefix"/**/*.gpg)
@ -13,13 +13,12 @@ passwordList() { \
password_files=$(printf '%s\n' "${password_files[@]}")
}
getPasswords() { \
getPasswords() {
choice="$(echo "$password_files" | grep -v "totp" | dmenu -i -p "Passwords")"
[ -z "$choice" ] && exit
pass -c "$choice"
notify-send "📋 Password for $choice copied!"
pass -c "$choice" && notify-send "📋 Password for $choice copied!"
}
getTOTP() {
@ -27,11 +26,10 @@ getTOTP() {
[ -z "$choice" ] && exit
pass otp -c "$choice"
notify-send "📋 OTP for $choice copied!"
pass otp -c "$choice" && notify-send "📋 OTP for $choice copied!"
}
addTOTP() { \
addTOTP() {
ifinstalled zbarimg || exit
name=$(printf "" | dmenu -i -p "What is the account name?")
@ -46,7 +44,7 @@ addTOTP() { \
rm "$totp_tmp"
}
addPassword() { \
addPassword() {
name=$(printf "" | dmenu -i -p "What is the account name?")
[ -z "$name" ] && exit
@ -63,7 +61,7 @@ addPassword() { \
notify-send "🔒 Password for $name added!"
}
removePassword() { \
removePassword() {
name="$(pass | echo "$password_files" | dmenu -i -p "Passwords")"
[ -z "$name" ] && exit