From bb755b367be2df206ae393114c46278cd9c82e40 Mon Sep 17 00:00:00 2001 From: krisdoodle45 <86745210+krisdoodle45@users.noreply.github.com> Date: Sun, 21 Nov 2021 16:15:56 +0100 Subject: [PATCH] Only notify when successfully copying password --- .local/bin/passwords | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.local/bin/passwords b/.local/bin/passwords index 1d623f33..8a35264b 100644 --- a/.local/bin/passwords +++ b/.local/bin/passwords @@ -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