summaryrefslogtreecommitdiff
path: root/.local/bin/getpass-otp
blob: 19c0c0edf15c931a43cff22e7372035549fb15db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

pb=$PASSWORD_STORE_DIR
[ -z "$PASSWORD_STORE_CLIP_TIME" ] && ct=45 || ct=$PASSWORD_STORE_CLIP_TIME
chars=$(echo $pb | wc -c)
accts=$(find $pb -type f -name "*.gpg" | cut -c $chars- | \
		rev | cut -c 5- | rev)
acct="$(echo "$accts" | dmenu)"
pass otp code $acct | xclip -r -selection "primary" \
		&& pass otp code $acct | xclip -r -selection "clipboard" \
		&& notify-send "OTP copied to clipboard" \
		&& sleep $ct \
		&& pkill xclip