On 2020-03-13 05:07, Daniel wrote: > On Mon, Feb 24, 2020 at 01:10:38PM +0000, Daniel wrote: >> On Sat, Feb 22, 2020 at 03:19:07PM +0100, [email protected] >> wrote: >>> Am 17.02.20 um 14:49 schrieb Daniel Cordero: >>>> In a resized/scaled wayland display, dmenu running under Xwayland can >>>> look blurry. >>>> >>>> On wayland, use a wayland-native menu program if it is available. >>>> Otherwise, continue using dmenu. >>> >>> Would it make sense to also add "dmenu-wl" to the list of supported >>> Wayland native applications for this? >> >> Honestly I don't have a list of compatible menus that I could use, so I >> just did the one that I use. >> >> I did plan to have it possible to define a list of working menu systems >> and for passmenu be able to test and use them, but I think I have another >> idea to just take an argument so that it could be used for any program. > > So I had a look at how passmenu handles command-line arguments, and, > umm well, it doesn't. Which means that adding any type of change here > might break people's current setups. > > Currently, passmenu takes arguments in the form: > > passmenu [--type] [<dmenu args>...] > > I want to add a --dmenu="" option, but this could be placed before, > after, or instead of the --type flag; and passmenu will still need to ignore > any dmenu args: > > passmenu --dmenu="dmenu-wl" --type <dmenu_args> > passmenu --type --dmenu="bemenu" <dmenu_args> > passmenu --dmenu="dmenu" <dmenu_args> > > Should I add a marker that differentiates the passmenu args from > the dmenu args, to make it more uniform? > > passmenu <passmenu_args> -- <dmenu_args> > > Perhaps put in a deprecation notice and stage patches for future > releases to avoid changing this suddenly I imagine most users of passmenu use it without arguments since "it just works", so testing for various menus may be the right way to go. I attached a patch; it adds the menus mentioned so far in the thread as well as 'rofi' and 'wofi' using IFS splitting. I've been using my own version of passmenu for rofi and wofi for a long time, since I prefer them to dmenu.
Additionally if the user wants another menu, they can specify
DMENU='some-program' passmenu
The second patch uses ydotool on wayland so --type will work.
From 1682dd22fa53c21db6665838dc7352e3d305f9e1 Mon Sep 17 00:00:00 2001 From: gammafn <[email protected]> Date: Fri, 13 Mar 2020 07:19:08 -0500 Subject: [PATCH] Test for compatible menus --- contrib/dmenu/passmenu | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu index 83268bc..c871b10 100755 --- a/contrib/dmenu/passmenu +++ b/contrib/dmenu/passmenu @@ -8,12 +8,30 @@ if [[ $1 == "--type" ]]; then shift fi +if [[ ! -v DMENU && -v WAYLAND_DISPLAY ]]; then + for DMENU in 'bemenu' 'dmenu-wl' 'wofi -d'; do + type -p "${DMENU%% *}" >/dev/null 2>&1 && break + unset DMENU + done +fi +if [[ ! -v DMENU && -v DISPLAY ]]; then + for DMENU in 'dmenu' 'rofi -dmenu'; do + type -p "${DMENU%% *}" >/dev/null 2>&1 && break + unset DMENU + done +fi +if [[ ! -v DMENU ]]; then + printf >&2 'No suitable menu found.\n' + exit 1 +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 "$@") +set -f +password=$(printf '%s\n' "${password_files[@]}" | $DMENU "$@") [[ -n $password ]] || exit -- 2.25.1
From 3686124cae11e6a832d1efc3bff0b1f11a9864b5 Mon Sep 17 00:00:00 2001 From: gammafn <[email protected]> Date: Fri, 13 Mar 2020 07:36:31 -0500 Subject: [PATCH] passmenu: Support wayland --type with ydotool --- contrib/dmenu/passmenu | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu index c871b10..28b4b1b 100755 --- a/contrib/dmenu/passmenu +++ b/contrib/dmenu/passmenu @@ -39,5 +39,9 @@ if [[ $typeit -eq 0 ]]; then pass show -c "$password" 2>/dev/null else pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | - xdotool type --clearmodifiers --file - + if [[ -v WAYLAND_DISPLAY ]]; then + ydotool type --file - + else + xdotool type --clearmodifiers --file - + fi fi -- 2.25.1
signature.asc
Description: OpenPGP digital signature
