summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-04-30 18:49:49 +0200
committerPacien TRAN-GIRARD2016-04-30 18:49:49 +0200
commitde7b77f70d76024f243e90393bfbcc3f28c01cc7 (patch)
tree22639f21708f9ab2ffc1e29637ab4d2388228a8e
parentbd9090cbfa02285cb0940e9bd6634b1d58b7b514 (diff)
downloaddesktop-utilities-de7b77f70d76024f243e90393bfbcc3f28c01cc7.tar.gz
Add "pass" password manager dmenu script
-rwxr-xr-xpassmenu.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/passmenu.sh b/passmenu.sh
new file mode 100755
index 0000000..6566ef4
--- /dev/null
+++ b/passmenu.sh
@@ -0,0 +1,26 @@
1#!/usr/bin/env bash
2
3shopt -s nullglob globstar
4
5typeit=0
6if [[ $1 == "--type" ]]; then
7 typeit=1
8 shift
9fi
10
11prefix=${PASSWORD_STORE_DIR-~/.password-store}
12password_files=( "$prefix"/**/*.gpg )
13password_files=( "${password_files[@]#"$prefix"/}" )
14password_files=( "${password_files[@]%.gpg}" )
15
16password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
17
18[[ -n $password ]] || exit
19
20if [[ $typeit -eq 0 ]]; then
21 pass show -c "$password" 2>/dev/null
22else
23 pass show "$password" | { read -r pass; printf %s "$pass"; } |
24 xdotool type --clearmodifiers --file -
25fi
26