blob: bb3be7aa38eeca739dd08fcd944eb452ff151ad6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/usr/bin/env bash
shopt -s nullglob globstar
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
while true; do
pass show "$password" 2>&1 \
| sed -e 's/^pass:.*/pass: XXXX/' \
| xmessage -file - \
-buttons "Done:1,Copy 'login':2,Copy 'pass':3,Copy all:4" \
-default "Done" \
-nearmouse -timeout 10
case "$?" in
2)
pass show "$password" 2>&1 \
| sed -ne 's/^login: \(.*\)/\1/p' \
| xclip -i -verbose -l 1 2>/dev/null
;;
3)
pass show "$password" 2>&1 \
| sed -ne 's/^pass: \(.*\)/\1/p' \
| xclip -i -verbose -l 1 2>/dev/null
;;
4)
pass show "$password" 2>&1 \
| xclip -i -verbose -l 1 2>/dev/null
;;
*)
break
;;
esac
done
|