gpg-agent.plugin.zsh 675 B

1234567891011121314151617
  1. export GPG_TTY=$TTY
  2. # Fix for passphrase prompt on the correct tty
  3. # See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport
  4. function _gpg-agent_update-tty_preexec {
  5. gpg-connect-agent updatestartuptty /bye &>/dev/null
  6. }
  7. autoload -U add-zsh-hook
  8. add-zsh-hook preexec _gpg-agent_update-tty_preexec
  9. # If enable-ssh-support is set, fix ssh agent integration
  10. if [[ $(gpgconf --list-options gpg-agent | awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then
  11. unset SSH_AGENT_PID
  12. if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then
  13. export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
  14. fi
  15. fi