Index: zshrc ================================================================== --- zshrc +++ zshrc @@ -343,13 +343,20 @@ # mpv does not like locales that use , as decimal point. __has_command mpv && alias mpv="LC_ALL=C mpv" if __has_command gpg gpg2; then - alias gssh="SSH_AUTH_SOCK=$GNUPGHOME/S.gpg-agent.ssh ssh" - alias gssh-add="SSH_AUTH_SOCK=$GNUPGHOME/S.gpg-agent.ssh ssh-add" - alias gsftp="SSH_AUTH_SOCK=$GNUPGHOME/S.gpg-agent.ssh sftp" + local sock + if [ -d "$XDG_RUNTIME_DIR/gnupg" ]; then + sock=$(find $XDG_RUNTIME_DIR/gnupg -name S.gpg-agent.ssh | + head -1) + fi + [ -n "$sock" ] || sock="$GNUPGHOME/S.gpg-agent.ssh" + + alias gssh="SSH_AUTH_SOCK=$sock ssh" + alias gssh-add="SSH_AUTH_SOCK=$sock ssh-add" + alias gsftp="SSH_AUTH_SOCK=$sock sftp" fi if __has_command cryptopassphrase; then pwnk() { local clipboard