1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/usr/bin/env bash
- shopt -s nullglob globstar
- stringContain()
- {
- [ -z "$1" ] || { [ -z "${2##*"$1"*}" ] && [ -n "$2" ];}
- }
- menu()
- {
- bemenu \
- --fb '#000000' \
- --ab '#000000' \
- --tb '#000000' \
- --nb '#000000' \
- --tf '#ffffff' \
- --hf '#ffffff' \
- --hb '#2e8b57' \
- --border 1 \
- --bdr '#333333' \
- --line-height 25 \
- --hp 10 \
- --fn "DejaVu Sans Mono 10" \
- --list 20 \
- --center \
- --no-spacing \
- --prompt "password-to-clipboard"
- }
- 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[@]}" | menu "$@")
- [[ -n $password ]] || exit
- pass show -c "$password" 2>/dev/null
|