I'd like to have all the passwords, that are stored in gnu-pass (the standard unix password manager), to be displayed in dmenu-mac via a shell script.
The shell script is working, only for the Directory/file
example.
Examples:
Social/example@email.com
(one directory) Works fineexample@email.com
(without directory) Does not workSocial/Personal/example@email.com
(more than one directory) Does not workThe following modified script that satisfies the first example, is taken from https://git.zx2c4.com/password-store/tree/contrib/dmenu/passmenu
#!/usr/bin/env bash
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi
if [[ -n $DISPLAY ]]; then
dmenu=/opt/homebrew/bin/dmenu-mac
xdotool="xdotool type --clearmodifiers --file -"
else
echo "Error: No Wayland or X11 display detected" >&2
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" "$@")
[[ -n $password ]] || exit
if [[ $typeit -eq 0 ]]; then
pass show -c "$password" 2>/dev/null
else
pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool
fi
Do modify the above script to satisfy all three examples.
My system: Apple M1 Pro Ventura 13.0.1
Thank you in advance.
I used the rewrite gopass
instead of pass
.
My problem with the script is that I only got 22 passwords displayed.
I could solve it by replacing bash
by zsh
in the first line. Where exactly this bug is I have not traced.