X-Git-Url: https://git.madduck.net/etc/ssh.git/blobdiff_plain/63c7606706cca46e64faff36167b62efff1f5ae1..c5b376136d7fd90f43bb8ca6d602850305221aed:/.ssh/rc diff --git a/.ssh/rc b/.ssh/rc index a70d65c..a755dca 100644 --- a/.ssh/rc +++ b/.ssh/rc @@ -3,3 +3,14 @@ PERSISTENT_AUTH_SOCK=$VARDIR/ssh/persistent-ssh-auth.sock if [ ! -S "$PERSISTENT_AUTH_SOCK" ] && [ -S "$SSH_AUTH_SOCK" ]; then ln -sf "$SSH_AUTH_SOCK" "$PERSISTENT_AUTH_SOCK" fi + +if [ -n "${DISPLAY:-}" ]; then + read proto cookie + if [ "${DISPLAY%%:*}" = localhost ]; then + # X11UseLocalhost=yes + echo add unix:$(echo $DISPLAY | cut -c11-) $proto $cookie + else + # X11UseLocalhost=no + echo add $DISPLAY $proto $cookie + fi | xauth -q - +fi