aboutsummaryrefslogtreecommitdiff
path: root/i3/bin/passmenu
diff options
context:
space:
mode:
authorCamil Staps2017-02-20 10:06:38 +0100
committerCamil Staps2017-02-20 10:06:38 +0100
commit73ae3a47a410eb2db9c3c776c0252e1feaeb2d7e (patch)
tree4835551f5d769ede433ed390d3cfc2406975480c /i3/bin/passmenu
parentCloogle stats in status bar (diff)
Reorganise binaries
Diffstat (limited to 'i3/bin/passmenu')
-rwxr-xr-xi3/bin/passmenu26
1 files changed, 26 insertions, 0 deletions
diff --git a/i3/bin/passmenu b/i3/bin/passmenu
new file mode 100755
index 0000000..9b5239d
--- /dev/null
+++ b/i3/bin/passmenu
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+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"/}" )
+password_files=( "${password_files[@]%.gpg}" )
+
+password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
+
+[[ -n $password ]] || exit
+
+if [[ $typeit -eq 0 ]]; then
+ pass show -c "$password" 2>/dev/null
+else
+ pass show "$password" |
+ awk 'BEGIN{ORS=""} {print; exit}' |
+ xdotool type --clearmodifiers --file -
+fi