mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-20 10:44:38 +10:00
25 lines
579 B
Bash
Executable File
25 lines
579 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
shopt -s nullglob globstar
|
|
|
|
typeit=0
|
|
if [[ $1 == "--type" ]]; then
|
|
typeit=1
|
|
shift
|
|
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[@]}" | wofi --dmenu "$@")
|
|
|
|
[[ -n $password ]] || exit
|
|
|
|
if [[ $typeit -eq 0 ]]; then
|
|
gopass show -c "$password" 2>/dev/null
|
|
else
|
|
pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } |
|
|
ydotool type --clearmodifiers --file -
|
|
fi |