blob: a7bd8cba326ae0dcc942aa72e30cbe7c9381a2c4 (
plain) (
blame)
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
41
42
43
|
#!/bin/sh
prefix=${PASSWORD_STORE_DIR:-~/.password-store}
get_password() {
dmenu -i -p pass
}
get_passwords() {
find -s "$prefix" -type f -name '*.gpg'
}
trim_prefix() {
while read line
do
printf '%s\n' "${line##$prefix/}"
done
}
trim_suffix() {
while read line
do
printf '%s\n' "${line%%.gpg}"
done
}
copy_pass() {
[ -n "$1" ] || return
otp=''
case "$1" in
totp*)
otp=otp
;;
esac
pass $otp show --clip "$1" 2>/dev/null
}
password=$(get_passwords | trim_prefix | trim_suffix | get_password)
[ -n "$password" ] || exit 0
msg=$(copy_pass "$password")
notify-send passmenu "$msg"
|