summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xtag-zsh/config/zsh/zshenv12
1 files changed, 9 insertions, 3 deletions
diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv
index c23be40..95377c1 100755
--- a/tag-zsh/config/zsh/zshenv
+++ b/tag-zsh/config/zsh/zshenv
@@ -66,8 +66,14 @@ then
 	eval "$(direnv hook zsh)"
 fi
 
-if [[ $os == gnu && ! -S $SSH_AUTH_SOCK && -s $commands[envoy] ]]
+if [[ -s $commands[gpg-agent ]]]
 then
-	envoy -t gpg-agent
-	eval $(envoy -p)
+	envfile="$HOME/.gnupg/gpg-agent.env"
+	if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then
+		eval "$(cat "$envfile")"
+	else
+		eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$envfile")"
+	fi
+	export GPG_AGENT_INFO  # the env file does not contain the export statement
+	export SSH_AUTH_SOCK   # enable gpg-agent for ssh
 fi