From 02f14a9cb152561a5e44062aac79f3b700403b40 Mon Sep 17 00:00:00 2001 From: navewindre Date: Sun, 13 Jul 2025 06:42:05 +0200 Subject: omz --- home/.oh-my-zsh/plugins/gpg-agent/gpg-agent.plugin.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 home/.oh-my-zsh/plugins/gpg-agent/gpg-agent.plugin.zsh (limited to 'home/.oh-my-zsh/plugins/gpg-agent/gpg-agent.plugin.zsh') diff --git a/home/.oh-my-zsh/plugins/gpg-agent/gpg-agent.plugin.zsh b/home/.oh-my-zsh/plugins/gpg-agent/gpg-agent.plugin.zsh new file mode 100644 index 0000000..1f4be20 --- /dev/null +++ b/home/.oh-my-zsh/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -0,0 +1,17 @@ +export GPG_TTY=$TTY + +# Fix for passphrase prompt on the correct tty +# See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport +function _gpg-agent_update-tty_preexec { + gpg-connect-agent updatestartuptty /bye &>/dev/null +} +autoload -U add-zsh-hook +add-zsh-hook preexec _gpg-agent_update-tty_preexec + +# If enable-ssh-support is set, fix ssh agent integration +if [[ $(gpgconf --list-options gpg-agent 2>/dev/null | awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then + unset SSH_AGENT_PID + if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + fi +fi -- cgit v1.2.3