summaryrefslogtreecommitdiff
path: root/contrib/dmenu/passmenu
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-06-29 11:35:03 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-06-29 11:41:15 +0200
commit326a12c9bf8f8b8a703c8a518c035f547524e01e (patch)
tree4c5e4fbfecf7e547fdc616b6e9c888a326223a67 /contrib/dmenu/passmenu
parentb300dd8f97a6d1d5ed914fedcba3e79604cd7e87 (diff)
downloadpass-326a12c9bf8f8b8a703c8a518c035f547524e01e.tar.gz
pass-326a12c9bf8f8b8a703c8a518c035f547524e01e.tar.bz2
pass-326a12c9bf8f8b8a703c8a518c035f547524e01e.zip
passmenu: type text with xdotool
Suggested-by: Christoph Egger <christoph@christoph-egger.org>
Diffstat (limited to '')
-rwxr-xr-xcontrib/dmenu/passmenu14
1 files changed, 13 insertions, 1 deletions
diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu
index 8ecb41f..a0da173 100755
--- a/contrib/dmenu/passmenu
+++ b/contrib/dmenu/passmenu
@@ -2,6 +2,12 @@
shopt -s nullglob globstar
+typeit=0
+if [[ $1 == "--type" ]]; then
+ typeit=1
+ shift
+fi
+
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
@@ -9,4 +15,10 @@ password_files=( "${password_files[@]%.gpg}" )
password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
-[[ -n $password ]] && pass show -c "$password" 2>/dev/null
+[[ -n $password ]] || exit
+
+if [[ $typeit -eq 0 ]]; then
+ pass show -c "$password" 2>/dev/null
+else
+ xdotool - <<<"type --clearmodifiers -- $(pass show "$password" | head -n 1)"
+fi