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