[PATCH] contrib/dmenu/passmenu: add support for dmenu-wayland
jman
password-store at storiepvtride.it
Tue Jan 5 21:11:54 UTC 2021
This patch adds a condition to check if $WAYLAND_DISPLAY is set. If yes
If yes we assume we are in Wayland window manager and switch to use
dmenu-wayland instead of dmenu.
---
contrib/dmenu/README.md | 4 +++-
contrib/dmenu/passmenu | 7 ++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/contrib/dmenu/README.md b/contrib/dmenu/README.md
index 9d54fb4..9631f29 100644
--- a/contrib/dmenu/README.md
+++ b/contrib/dmenu/README.md
@@ -2,12 +2,14 @@
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.
+(X11 only) instead of copied to the clipboard.
+Wayland window managers (based on wlroots) are supported by using [dmenu-wayland][].
# Usage
passmenu [--type] [dmenu arguments...]
[dmenu]: http://tools.suckless.org/dmenu/
+[dmenu-wayland]: https://github.com/nyyManni/dmenu-wayland
[xdotool]: http://www.semicomplete.com/projects/xdotool/
[pass]: http://www.zx2c4.com/projects/password-store/
diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu
index 83268bc..c92b060 100755
--- a/contrib/dmenu/passmenu
+++ b/contrib/dmenu/passmenu
@@ -8,12 +8,17 @@ if [[ $1 == "--type" ]]; then
shift
fi
+dmenu_bin=dmenu
+if [[ -n $WAYLAND_DISPLAY ]]; then
+ dmenu_bin="dmenu-wl -i"
+fi
+
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_bin "$@")
[[ -n $password ]] || exit
--
2.29.2
More information about the Password-Store
mailing list