diff options
| author | --global <ik.boikov.public@protonmail.com> | 2021-08-01 21:25:23 +0200 |
|---|---|---|
| committer | --global <ik.boikov.public@protonmail.com> | 2021-08-01 21:25:23 +0200 |
| commit | f2b9860ff378bc0a02137bc1a8955a51705e2935 (patch) | |
| tree | 8a2ecb1674442be6ee2ee22d47c1a824fcf7ffe7 /scripts | |
| parent | 1372973fc35e9b440f8e993ad9679ed5d905a831 (diff) | |
migration to pass, themes dir name fix
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/.local/bin/dpass | 36 | ||||
| -rwxr-xr-x | scripts/.local/bin/pass-askpass | 9 |
2 files changed, 45 insertions, 0 deletions
diff --git a/scripts/.local/bin/dpass b/scripts/.local/bin/dpass new file mode 100755 index 0000000..9da7c0d --- /dev/null +++ b/scripts/.local/bin/dpass @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +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"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | "$dmenu" -l 30 "$@") + +[[ -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 + diff --git a/scripts/.local/bin/pass-askpass b/scripts/.local/bin/pass-askpass new file mode 100755 index 0000000..6fbb003 --- /dev/null +++ b/scripts/.local/bin/pass-askpass @@ -0,0 +1,9 @@ +#! /bin/sh + +# shellcheck disable=2046 +caller="$(ps -o comm= -p $(ps -o ppid= -p $$))" +prompt="${1:-[$caller]}" +hidden=black + +dmenu -p "$prompt" -nf "$hidden" -nb "$hidden" <&- + |
