diff --git a/modules/gpg-agent/init.zsh b/modules/gpg-agent/init.zsh index 6d010d2..82bd9a2 100644 --- a/modules/gpg-agent/init.zsh +++ b/modules/gpg-agent/init.zsh @@ -4,6 +4,7 @@ # Authors: # Florian Walch # Sorin Ionescu +# neersighted # # Return if requirements are not found. @@ -11,7 +12,8 @@ if (( ! $+commands[gpg-agent] )); then return 1 fi -_gpg_env="$HOME/.gnupg/gpg-agent.env" +# Make sure to use the $GNUPGHOME first. +_gpg_env="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.env" function _gpg-agent-start { local ssh_support @@ -20,7 +22,8 @@ function _gpg-agent-start { || ssh_support='' gpg-agent \ - --daemon ${ssh_support:+'--enable-ssh-support'} + --daemon \ + ${ssh_support:+'--enable-ssh-support'} \ --write-env-file "${_gpg_env}" > /dev/null chmod 600 "${_gpg_env}" @@ -41,4 +44,3 @@ export GPG_AGENT_INFO export SSH_AUTH_SOCK export SSH_AGENT_PID export GPG_TTY="$(tty)" -