summaryrefslogtreecommitdiff
path: root/.local/bin/getpass-otp
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/getpass-otp')
-rwxr-xr-x.local/bin/getpass-otp14
1 files changed, 14 insertions, 0 deletions
diff --git a/.local/bin/getpass-otp b/.local/bin/getpass-otp
new file mode 100755
index 0000000..535cc31
--- /dev/null
+++ b/.local/bin/getpass-otp
@@ -0,0 +1,14 @@
1#!/bin/sh
2
3pb=$PASSWORD_STORE_DIR
4[ -z "$PASSWORD_STORE_CLIP_TIME" ] && ct=45 || ct=$PASSWORD_STORE_CLIP_TIME
5chars=$(echo $pb | wc -c)
6accts=$(find $pb -type f -name "*-OTP.gpg" | cut -c $chars- | \
7 rev | cut -c 5- | rev)
8acct="$(echo "$accts" | dmenu)"
9pass otp code $acct | xclip -r -selection "primary" \
10 && pass otp code $acct | xclip -r -selection "clipboard" \
11 && notify-send "OTP copied to clipboard" \
12 && sleep $ct \
13 && pkill xclip
14