From f814f92a20edc3e19b8cac0d1380f89690a68732 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Wed, 8 May 2024 22:41:33 +0530 Subject: dpass: clean up --- dpass | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'dpass') diff --git a/dpass b/dpass index 670f398..a241c83 100755 --- a/dpass +++ b/dpass @@ -2,13 +2,14 @@ pass_store_dir="${PASSWORD_STORE_DIR:-$HOME/.pass}" menu="bemenu" +icon="󰟵 " note() { : "${1:?}" command -v notify-send > /dev/null && - notify-send "󰟵 dpass" "$1" + notify-send "$icon dpass" "$1" } die() @@ -42,8 +43,7 @@ search() do pass_path="${pass_path}/$(printf '%s\n' "$pass_path"/* | sed 's/.*\///g' | - "$menu" -l 25 -p "󰟵 ${pass_path##*/} ")" || - die "noting selected" + "$menu" -l 25 -p "$icon ${pass_path##*/} ")" || exit 1 done pass_path="${pass_path#"${pass_store_dir}"/}" @@ -54,9 +54,7 @@ main() { pass_path= - [ -z "$WAYLAND_DISPLAY" ] && - menu="dmenu" - + [ -z "$WAYLAND_DISPLAY" ] && menu="dmenu" dep_check "$menu" "pass" case "$1" in @@ -88,15 +86,19 @@ main() EOF ;; ""|-t) + search "$pass_store_dir" + secret="$(pass "$pass_path")" || { + note 'decryption failed' + exit + } + if [ -z "$WAYLAND_DISPLAY" ] then dep_check "xdotool" - search "$pass_store_dir" - xdotool type --delay 20 "$(pass "$pass_path")" + xdotool type --delay 20 "$secret" else dep_check "wtype" - search "$pass_store_dir" - wtype -d 20 "$(pass "$pass_path")" + wtype -d 20 "$secret" fi ;; *) -- cgit v1.2.3