password-store

Simple password manager using gpg and ordinary unix directories
git clone https://git.zx2c4.com/password-store
Log | Files | Refs | README | LICENSE

commit 326a12c9bf8f8b8a703c8a518c035f547524e01e
parent b300dd8f97a6d1d5ed914fedcba3e79604cd7e87
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Sun, 29 Jun 2014 11:35:03 +0200

passmenu: type text with xdotool

Suggested-by: Christoph Egger <christoph@christoph-egger.org>

Diffstat:
Mcontrib/dmenu/README.md | 6++++--
Mcontrib/dmenu/passmenu | 14+++++++++++++-
2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/contrib/dmenu/README.md b/contrib/dmenu/README.md @@ -1,11 +1,13 @@ `passmenu` is a [dmenu][]-based interface to [pass][], the standard Unix password manager. This design allows you to quickly copy a password to the clipboard without having to open up a terminal window if you don't already have -one open. +one open. If `--type` is specified, the password is typed using [xdotool][] +instead of copied to the clipboard. # Usage - passmenu [dmenu arguments...] + passmenu [--type] [dmenu arguments...] [dmenu]: http://tools.suckless.org/dmenu/ +[xdotool]: http://www.semicomplete.com/projects/xdotool/ [pass]: http://www.zx2c4.com/projects/password-store/ diff --git 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