]> git.immae.eu Git - perso/Immae/Config/Ansible.git/blobdiff - roles/tools/files/ssh/rc
ssh and tmux configuration fixes
[perso/Immae/Config/Ansible.git] / roles / tools / files / ssh / rc
index 35b7d342e713230b7124a0e119c27d54022c44e2..32d1bd465e85df2a286768770a82159d062ecb43 100644 (file)
@@ -1,8 +1,9 @@
 #!/bin/bash
 
-if [ -n "$DISPLAY" ]; then
-  export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
-  read protocol cookie
-  xauth remove $DISPLAY
-  xauth add $DISPLAY "$protocol" "$cookie"
+if read proto cookie && [ -n "$DISPLAY" ]; then
+  if [ `echo $DISPLAY | cut -c1-10` = "localhost:" ]; then
+    echo add unix:`echo $DISPLAY | cut -c11-` $proto $cookie
+  else
+    echo add $DISPLAY "$protocol" "$cookie"
+  fi | xauth -q -
 fi