diff --git a/modules/gpg-agent/init.zsh b/modules/gpg-agent/init.zsh index bc636bad..0208260b 100644 --- a/modules/gpg-agent/init.zsh +++ b/modules/gpg-agent/init.zsh @@ -14,7 +14,7 @@ if (( ! $+commands[gpg-agent] )); then fi # Make sure to use the $GNUPGHOME first. -_gpg_env="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.env" +_gpg_env="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.info" function _gpg-agent-start { local ssh_support @@ -34,9 +34,10 @@ function _gpg-agent-start { # Source GPG agent settings, if applicable. if [[ -s "${_gpg_env}" ]]; then source "${_gpg_env}" > /dev/null - ps -e | grep $(grep GPG_AGENT_INFO $_gpg_env | cut -d: -f 2) | grep -q gpg-agent || - _gpg-agent-start - } + ps -U "$USER" -o 'command,pid' \ + | grep "${${(@s.:.)GPG_AGENT_INFO}[2]}" \ + | grep -q '^gpg-agent' \ + || _gpg-agent-start else _gpg-agent-start fi