summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2016-01-09 10:49:50 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-05 00:18:32 +0200
commit45ef3ddb26a165984623c0c171102c1a56ee49f3 (patch)
treedce8be7fe9dfd3ab4111ff49e19a8ad45ad257ec
parentc8f88f358d92b20b90335d0e9a8fea41c5f04cfd (diff)
downloadpass-45ef3ddb26a165984623c0c171102c1a56ee49f3.tar.gz
pass-45ef3ddb26a165984623c0c171102c1a56ee49f3.tar.bz2
pass-45ef3ddb26a165984623c0c171102c1a56ee49f3.zip
[passmenu] type both
-rwxr-xr-xcontrib/dmenu/passmenu32
1 files changed, 21 insertions, 11 deletions
diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu
index d371ea9..3fba44e 100755
--- a/contrib/dmenu/passmenu
+++ b/contrib/dmenu/passmenu
@@ -3,16 +3,17 @@
shopt -s nullglob globstar
typeit=0
-if [[ $1 == "--type" ]]; then
- typeit=1
- shift
-fi
-
user=
-if [[ $1 == "--user" ]]; then
- user=-u
- shift
-fi
+both=0
+
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ "--type") typeit=1; shift;;
+ "--user") user=-u; shift;;
+ "--both") both=1; shift;;
+ *) break;;
+ esac
+done
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
@@ -23,9 +24,18 @@ password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
[[ -n $password ]] || exit
+xdo() {
+ local user=$1
+ pass show $user "$password" | { IFS= read -r pass; printf %s "$pass"; } |
+ xdotool type --clearmodifiers --file -
+}
+
if [[ $typeit -eq 0 ]]; then
pass show $user -c "$password" 2>/dev/null
+elif [[ $both -eq 0 ]]; then
+ xdo $user
else
- pass show $user "$password" | { IFS= read -r pass; printf %s "$pass"; } |
- xdotool type --clearmodifiers --file -
+ xdo
+ xdotool key Tab
+ xdo -u
fi