summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2022-06-16 21:30:28 -0400
committerSam Chudnick <sam@chudnick.com>2022-06-16 21:30:28 -0400
commit76648c5bb4d22aa4745c25e715465254759a35cc (patch)
treecb2e160148a78185db0a0b9568afea838a597b06
parent3c1666bd4791467e11b53b843e062b2122c59b33 (diff)
Added scripts for interacting with pass via dmenu
Added two scripts for getting passwords and OTPs from pass by selecting an entry from dmenu. This enables passwords to be retrieved easily by binding these scripts to hotkeys. Both scripts place the output on the clipboard.
-rwxr-xr-x.local/bin/getpass15
-rwxr-xr-x.local/bin/getpass-otp14
2 files changed, 29 insertions, 0 deletions
diff --git a/.local/bin/getpass b/.local/bin/getpass
new file mode 100755
index 0000000..bfa344f
--- /dev/null
+++ b/.local/bin/getpass
@@ -0,0 +1,15 @@
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 "*.gpg" | cut -c 2- | \
7 grep -v ".*-OTP.gpg\|.*-2farecovery.gpg" | cut -c $chars- | \
8 rev | cut -c 5- | rev)
9acct="$(echo "$accts" | dmenu)"
10[ "$acct" = "" ] && exit
11pass show $acct | xclip -r -selection "primary" \
12 && pass show $acct | xclip -r -selection "clipboard" \
13 && notify-send "Password Copied to Clipboard" \
14 && sleep $ct \
15 && pkill xclip
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