diff options
author | Pacien TRAN-GIRARD | 2016-04-30 18:49:49 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2016-04-30 18:49:49 +0200 |
commit | de7b77f70d76024f243e90393bfbcc3f28c01cc7 (patch) | |
tree | 22639f21708f9ab2ffc1e29637ab4d2388228a8e | |
parent | bd9090cbfa02285cb0940e9bd6634b1d58b7b514 (diff) | |
download | desktop-utilities-de7b77f70d76024f243e90393bfbcc3f28c01cc7.tar.gz |
Add "pass" password manager dmenu script
-rwxr-xr-x | passmenu.sh | 26 |
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 | |||
3 | shopt -s nullglob globstar | ||
4 | |||
5 | typeit=0 | ||
6 | if [[ $1 == "--type" ]]; then | ||
7 | typeit=1 | ||
8 | shift | ||
9 | fi | ||
10 | |||
11 | prefix=${PASSWORD_STORE_DIR-~/.password-store} | ||
12 | password_files=( "$prefix"/**/*.gpg ) | ||
13 | password_files=( "${password_files[@]#"$prefix"/}" ) | ||
14 | password_files=( "${password_files[@]%.gpg}" ) | ||
15 | |||
16 | password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@") | ||
17 | |||
18 | [[ -n $password ]] || exit | ||
19 | |||
20 | if [[ $typeit -eq 0 ]]; then | ||
21 | pass show -c "$password" 2>/dev/null | ||
22 | else | ||
23 | pass show "$password" | { read -r pass; printf %s "$pass"; } | | ||
24 | xdotool type --clearmodifiers --file - | ||
25 | fi | ||
26 | |||