blob: be41b51d7004dc69c53716d4816a035fc4a9a968 (
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
|
#!/bin/sh
# my Pass MEnu
otp=
user=
while getopts ou opt; do
case $opt in
o) otp=1;;
u) user=1;;
\?) exit 1;;
esac
done
find "$HOME/.password-store/" \( -type f -o -type l \) -name '*.gpg' \
| sed "s#$HOME/\.password-store/\(.*\)\.gpg\$#\1#" \
| dmenu -i -p 'pass' \
| {
if [ "$otp" ]; then
xargs pass otp | tr '\n' '\r'
else
xargs pass | {
if [ "$user" ]; then
# https://www.gnu.org/software/gawk/manual/html_node/Case_002dsensitivity.html
awk 'tolower($1) ~ /^(user|username):$/ {printf $2}'
else
# modified from https://git.zx2c4.com/password-store/tree/contrib/dmenu/passmenu#n34 GPL-2.0-or-later code
IFS= read -r p; printf '%s' "$p"
fi
}
fi
} \
| xdotool type --clearmodifiers --file -
|