diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-12-24 13:54:03 +0900 |
| commit | 28e8bdf7f8286bd431b7f3b709e79f3827b31469 (patch) | |
| tree | 85b44eff6da4d8443198fb6e04dfb6ee55244588 /debian/.local/bin/passmenu2 | |
| parent | 8470ff001befcfd0f626dea69a9e76d43aee0511 (diff) | |
updates
Diffstat (limited to 'debian/.local/bin/passmenu2')
| -rwxr-xr-x | debian/.local/bin/passmenu2 | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/debian/.local/bin/passmenu2 b/debian/.local/bin/passmenu2 new file mode 100755 index 0000000..00a6b35 --- /dev/null +++ b/debian/.local/bin/passmenu2 @@ -0,0 +1,38 @@ +#!/bin/bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +if [[ -n $WAYLAND_DISPLAY ]]; then + dmenu_cmd="dmenu-wl -l 20" + xdotool="ydotool type --file -" +elif [[ -n $DISPLAY ]]; then + dmenu_cmd="dmenu -l 20" + 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_cmd "$@") + +[[ -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 |
