diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-05-08 22:41:33 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-05-08 22:41:33 +0530 |
commit | f814f92a20edc3e19b8cac0d1380f89690a68732 (patch) | |
tree | c67996214ad16c7fbbf83d066be9e37c43c486c2 /dpass | |
parent | 992a7561efffd4d5c3acb00cad80bd238b87b6f6 (diff) |
dpass: clean up
Diffstat (limited to 'dpass')
-rwxr-xr-x | dpass | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -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 ;; *) |