commit 758552b49222a78e175ebaafe198ee4c39009c83
parent ee239063d39b4f1e44078d198473c651e132be54
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 14 May 2020 15:59:32 +0200
Add option to type out primary/clipboard contents
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/.local/bin/passmenu b/.local/bin/passmenu
@@ -49,6 +49,7 @@ die()
get_password_files()
{
find "$pass_dir" -type f -iname "*.gpg"
+ printf 'primary\nclipboard\n'
}
strip_root_dir()
@@ -72,9 +73,6 @@ match_password_file()
die 'aborted by user'
fi
fi
- if [ ! -r "${pass_dir}/${_passfile}.gpg" ]; then
- die "no password file: $pass_dir/$_passfile"
- fi
printf '%s\n' "$_passfile"
}
@@ -85,6 +83,10 @@ retrieve_password()
printf "$prefix" | xdotool type --clearmodifiers --file -
fi
+ if [ ! -r "$_passfile" ]; then
+ xdotool type "$(xclip -o -selection "$1")"
+ exit 0
+ fi
if [ "$typeout" = 1 ]; then
pass show "$_passfile" | \
{ IFS= read -r pass; printf %s "$pass"; } | \