[PATCH] passmenu: more alternatives for dmenu on wayland
Steef Hegeman
mail at steefhegeman.com
Thu Feb 17 18:41:20 UTC 2022
If dmenu-wl is not available, try to use wofi -d or bemenu instead.
---
Hello,
There is no standard dmenu alternative for wayland. This makes the
script try common* ones. It tries dmenu-wl first for backwards
compatibility.
* common in the sense that wofi and bemenu are what
xdg-desktop-portal-wlr looks for. (I use bemenu myself.)
Kind regards,
Steef
contrib/dmenu/README.md | 9 ++++++---
contrib/dmenu/passmenu | 6 ++++--
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/contrib/dmenu/README.md b/contrib/dmenu/README.md
index 8a196cb..1eb8c9d 100644
--- a/contrib/dmenu/README.md
+++ b/contrib/dmenu/README.md
@@ -4,9 +4,10 @@ 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.
-On wayland [dmenu-wl][] is used to replace dmenu and [ydotool][] to replace xdotool.
-Note that the latter requires access to the [uinput][] device, so you'll probably
-need to add an extra udev rule or similar to give certain non-root users permission.
+On wayland [dmenu-wl][] or [wofi][] or [bemenu][] is used to replace dmenu and
+[ydotool][] to replace xdotool. Note that the latter requires access to the
+[uinput][] device, so you'll probably need to add an extra udev rule or similar
+to give certain non-root users permission.
# Usage
@@ -16,5 +17,7 @@ need to add an extra udev rule or similar to give certain non-root users permiss
[xdotool]: http://www.semicomplete.com/projects/xdotool/
[pass]: http://www.zx2c4.com/projects/password-store/
[dmenu-wl]: https://github.com/nyyManni/dmenu-wayland
+[wofi]: https://hg.sr.ht/~scoopta/wofi
+[bemenu]: https://github.com/Cloudef/bemenu
[ydotool]: https://github.com/ReimuNotMoe/ydotool
[uinput]: https://www.kernel.org/doc/html/v4.12/input/uinput.html
diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu
index 76d92ab..3b0f7a0 100755
--- a/contrib/dmenu/passmenu
+++ b/contrib/dmenu/passmenu
@@ -9,7 +9,9 @@ if [[ $1 == "--type" ]]; then
fi
if [[ -n $WAYLAND_DISPLAY ]]; then
- dmenu=dmenu-wl
+ for dmenu in dmenu-wl "wofi -d" bemenu ; do
+ command -v "${dmenu%% *}" &> /dev/null && break
+ done
xdotool="ydotool type --file -"
elif [[ -n $DISPLAY ]]; then
dmenu=dmenu
@@ -24,7 +26,7 @@ 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.35.1
More information about the Password-Store
mailing list