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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 .local/bin/getpass (limited to '.local/bin/getpass') 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 @@ +#!/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 2- | \ + grep -v ".*-OTP.gpg\|.*-2farecovery.gpg" | cut -c $chars- | \ + rev | cut -c 5- | rev) +acct="$(echo "$accts" | dmenu)" +[ "$acct" = "" ] && exit +pass show $acct | xclip -r -selection "primary" \ + && pass show $acct | xclip -r -selection "clipboard" \ + && notify-send "Password Copied to Clipboard" \ + && sleep $ct \ + && pkill xclip -- cgit v1.2.3