#!/usr/bin/env fish # Launch GPG Agent or connect to it set -e SSH_AGENT_PID set -x GPG_TTY (tty) if not set -q gnupg_SSH_AUTH_SOCK_by or test $gnupg_SSH_AUTH_SOCK_by -ne %self set -gx SSH_AUTH_SOCK "$HOME/.gnupg/S.gpg-agent.ssh" end export GPG_AGENT_INFO="$HOME/.gnupg/S.gpg-agent:0:1" if [ ! (pgrep -x -u $USER "gpg-agent" | head -1) ] set -el DISPLAY echo "Invoking gpg-agent" gpg-connect-agent /bye >/dev/null end