From 76648c5bb4d22aa4745c25e715465254759a35cc Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Thu, 16 Jun 2022 21:30:28 -0400 Subject: 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. --- .local/bin/getpass-otp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 .local/bin/getpass-otp (limited to '.local/bin/getpass-otp') 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 @@ +#!/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 "*-OTP.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 + -- cgit v1.2.3