summaryrefslogtreecommitdiff
path: root/sh/pme
blob: ff6c711309c4c1d7c93105a331b4ec4fc7c3bd11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
# my Pass MEnu

find "$HOME/.password-store/" \( -type f -o -type l \) -name '*.gpg' \
	| sed "s#$HOME/\.password-store/\(.*\)\.gpg\$#\1#" \
	| dmenu -i -p 'pass' \
	| {
		case "$1" in
			# `{ IFS= read -r p; printf '%s\r' "$p";}` is modified from https://git.zx2c4.com/password-store/tree/contrib/dmenu/passmenu#n34 GPL-2.0-or-later code
			'') xargs pass | { IFS= read -r p; printf '%s\r' "$p";};;
			'-o') xargs pass otp | tr '\n' '\r';;
			*) exit 1;;
		esac
	} \
	| xdotool type --clearmodifiers --file -