Hi all!
Thanks for the work you do every day with this extremely useful piece of 
software. I had the need to use pass-otp from the dmenu interface and 
didn't 
find a way with the current version of passmenu, so I decided to patch it.
Here you can find the (smallest as possible) patch in attachment, I hope 
you 
can include it in the sources, I think this will be extremely useful for every 
person who uses 2FA with unix-pass and a dmenu interface.


Thanks for reading this email.
Alessandro 'kLeZ' Accardo.

>From 0dc74d22042c8797626e009e065958f349f74606 Mon Sep 17 00:00:00 2001
From: Alessandro Accardo <julius8...@gmail.com>
Date: Wed, 12 Sep 2018 09:38:47 +0200
Subject: [PATCH] * Added the ability to use pass-otp with argument

---
 contrib/dmenu/passmenu | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu
index 83268bc..86b8252 100755
--- a/contrib/dmenu/passmenu
+++ b/contrib/dmenu/passmenu
@@ -2,11 +2,16 @@
 
 shopt -s nullglob globstar
 
+otp=0
 typeit=0
 if [[ $1 == "--type" ]]; then
 	typeit=1
 	shift
 fi
+if [[ $1 == "--otp" ]]; then
+    otp=1
+    shift
+fi
 
 prefix=${PASSWORD_STORE_DIR-~/.password-store}
 password_files=( "$prefix"/**/*.gpg )
@@ -17,9 +22,14 @@ password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
 
 [[ -n $password ]] || exit
 
+pass_cmd="show"
+if [[ $otp -eq 1 ]]; then
+    pass_cmd="otp"
+fi
+
 if [[ $typeit -eq 0 ]]; then
-	pass show -c "$password" 2>/dev/null
+    pass $pass_cmd -c "$password" 2>/dev/null
 else
-	pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } |
-		xdotool type --clearmodifiers --file -
+    pass $pass_cmd "$password" | { IFS= read -r pass; printf %s "$pass"; } |
+	xdotool type --clearmodifiers --file -
 fi
-- 
2.16.4

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Password-Store mailing list
Password-Store@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to