diff options
Diffstat (limited to 'contrib/dmenu/passmenu')
-rwxr-xr-x | contrib/dmenu/passmenu | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/contrib/dmenu/passmenu b/contrib/dmenu/passmenu index bb8e7d6..e5635fd 100755 --- a/contrib/dmenu/passmenu +++ b/contrib/dmenu/passmenu @@ -20,6 +20,17 @@ while [[ $# -gt 0 && $finish -eq 0 ]]; do [[ $finish -eq 0 ]] && shift done +if [[ -n $WAYLAND_DISPLAY ]]; then + dmenu=dmenu-wl + xdotool="ydotool type --file -" +elif [[ -n $DISPLAY ]]; then + dmenu=dmenu + 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"/}" ) @@ -33,7 +44,7 @@ if [[ $otp -eq 1 ]]; then password_files=(${filtered_files[@]}) fi -password=$(printf '%s\n' "${password_files[@]}" | dmenu "$@") +password=$(printf '%s\n' "${password_files[@]}" | "$dmenu" "$@") [[ -n $password ]] || exit @@ -50,5 +61,5 @@ if [[ $typeit -eq 0 ]]; then pass $otp_arg show -c "$password" 2>/dev/null else pass $otp_arg show "$password" | { IFS= read -r pass; printf %s "$pass"; } | - xdotool type --clearmodifiers --file - + $xdotool fi |