Hi,
I added an argument to passmenu: the --dmenu argument. It lets you choose the 
dmenu executable. Its main purpose it to use a dmenu emulator like "rofi 
-dmenu". It keeps compatibility with --type.

From the testing I've done it works.

Let me know what you think about it.
example:
passmenu --dmenu "rofi -dmenu"

Nils André
From e73e90c7f77e4e06cf11048cddc9c37c460a7d89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nils=20ANDR=C3=89-CHANG?= <[email protected]>
Date: Fri, 1 Jun 2018 19:56:11 +0100
Subject: [PATCH] Added the --dmenu argument

---
 contrib/dmenu/README.md |  5 +++--
 contrib/dmenu/passmenu  | 15 ++++++++++-----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/contrib/dmenu/README.md b/contrib/dmenu/README.md
index 9d54fb4..1366763 100644
--- a/contrib/dmenu/README.md
+++ b/contrib/dmenu/README.md
@@ -2,11 +2,12 @@
 password manager. This design allows you to quickly copy a password to the
 clipboard without having to open up a terminal window if you don't already have
 one open. If `--type` is specified, the password is typed using [xdotool][]
-instead of copied to the clipboard.
+instead of copied to the clipboard. If `--dmenu` is specified, dmenu will be
+executed as a dmenu emulator.
 
 # Usage
 
-    passmenu [--type] [dmenu arguments...]
+    passmenu [--type] [--dmenu dmenu] [dmenu arguments...]
 
 [dmenu]: http://tools.suckless.org/dmenu/
 [xdotool]: http://www.semicomplete.com/projects/xdotool/
diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu
index 83268bc..a0ae8d6 100755
--- a/contrib/dmenu/passmenu
+++ b/contrib/dmenu/passmenu
@@ -3,17 +3,22 @@
 shopt -s nullglob globstar
 
 typeit=0
-if [[ $1 == "--type" ]]; then
-	typeit=1
-	shift
-fi
+dmenu="dmenu"
+
+while [[ $# -gt 0 ]]
+do
+    case "$1" in
+        --type) shift; typeit=1;;
+        --dmenu) dmenu=$2; shift 2;;
+    esac
+done
 
 prefix=${PASSWORD_STORE_DIR-~/.password-store}
 password_files=( "$prefix"/**/*.gpg )
 password_files=( "${password_files[@]#"$prefix"/}" )
 password_files=( "${password_files[@]%.gpg}" )
 
-password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
+password=$(printf '%s\n' "${password_files[@]}" | $dmenu "$@")
 
 [[ -n $password ]] || exit
 
-- 
2.17.0

_______________________________________________
Password-Store mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to