executable_passmenu 869 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env bash
  2. shopt -s nullglob globstar
  3. stringContain()
  4. {
  5. [ -z "$1" ] || { [ -z "${2##*"$1"*}" ] && [ -n "$2" ];}
  6. }
  7. menu()
  8. {
  9. bemenu \
  10. --fb '#000000' \
  11. --ab '#000000' \
  12. --tb '#000000' \
  13. --nb '#000000' \
  14. --tf '#ffffff' \
  15. --hf '#ffffff' \
  16. --hb '#2e8b57' \
  17. --border 1 \
  18. --bdr '#333333' \
  19. --line-height 25 \
  20. --hp 10 \
  21. --fn "DejaVu Sans Mono 10" \
  22. --list 20 \
  23. --center \
  24. --no-spacing \
  25. --prompt "password-to-clipboard"
  26. }
  27. prefix=${PASSWORD_STORE_DIR-~/.password-store}
  28. password_files=("$prefix"/**/*.gpg)
  29. password_files=("${password_files[@]#"$prefix"/}")
  30. password_files=("${password_files[@]%.gpg}")
  31. password=$(printf '%s\n' "${password_files[@]}" | menu "$@")
  32. [[ -n $password ]] || exit
  33. pass show -c "$password" 2>/dev/null