[PATCH] Allow alternatives to dmenu for passmenu

sternenseemann sternenseemann at systemli.org
Thu Jan 28 20:03:02 UTC 2021


I think this is also the best solution for allowing wayland support in
passmenu. A similar environment variable for xdotool could also be
worthwhile so users can switch to ydotool.

On 1/28/21 8:08 PM, Stefan Gehr wrote:
> Set the environment variable $PASSMENU_PROGRAM to your preferred menu
> program. If it isn't set then dmenu will be used. This allows users to
> use alternatives like bemenu.
> ---
>  contrib/{dmenu => passmenu}/README.md | 4 +++-
>  contrib/{dmenu => passmenu}/passmenu  | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
>  rename contrib/{dmenu => passmenu}/README.md (72%)
>  rename contrib/{dmenu => passmenu}/passmenu (79%)
> 
> diff --git a/contrib/dmenu/README.md b/contrib/passmenu/README.md
> similarity index 72%
> rename from contrib/dmenu/README.md
> rename to contrib/passmenu/README.md
> index 9d54fb4..cee87eb 100644
> --- a/contrib/dmenu/README.md
> +++ b/contrib/passmenu/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.
> +instead of copied to the clipboard. You can use alternatives to dmenu, like
> +[bemenu][], by setting `$PASSMENU_PROGRAM` to the program of your preference.
>  
>  # Usage
>  
>      passmenu [--type] [dmenu arguments...]
>  
>  [dmenu]: http://tools.suckless.org/dmenu/
> +[bemenu]: https://github.com/Cloudef/bemenu
>  [xdotool]: http://www.semicomplete.com/projects/xdotool/
>  [pass]: http://www.zx2c4.com/projects/password-store/
> diff --git a/contrib/dmenu/passmenu b/contrib/passmenu/passmenu
> similarity index 79%
> rename from contrib/dmenu/passmenu
> rename to contrib/passmenu/passmenu
> index 83268bc..f63b9e6 100755
> --- a/contrib/dmenu/passmenu
> +++ b/contrib/passmenu/passmenu
> @@ -13,7 +13,9 @@ password_files=( "$prefix"/**/*.gpg )
>  password_files=( "${password_files[@]#"$prefix"/}" )
>  password_files=( "${password_files[@]%.gpg}" )
>  
> -password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@")
> +[[ "$PASSMENU_PROGRAM" ]] || PASSMENU_PROGRAM="dmenu"
> +
> +password=$(printf '%s\n' "${password_files[@]}" | "$PASSMENU_PROGRAM" "$@")
>  
>  [[ -n $password ]] || exit
>  
> 


More information about the Password-Store mailing list