m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/contrib/dmenu/passmenu
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/dmenu/passmenu')
-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