From 20a8b880aff9582ad3ad2201be1b9de43d60f513 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Thu, 24 Feb 2022 18:29:37 -0500 Subject: xvnc: use unix socket instead of tcp, always (now requires xtigervncviewer) --- dot/local/bin/xvnc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/dot/local/bin/xvnc b/dot/local/bin/xvnc index 3265a38..2984aa7 100755 --- a/dot/local/bin/xvnc +++ b/dot/local/bin/xvnc @@ -15,21 +15,21 @@ ssh() direct_connection() { - port=$((5900 + ${local_display#*:})) - ssh -o ControlPath=none -n \ - -L $port:localhost:$port \ - ${remote_port:+-p $remote_port} \ + rando=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c15) && [ "$rando" ] + remote_socket_file=/tmp/x11vnc.$rando.socket + local_socket_file=/tmp/xtigervncviewer.$rando.socket + + ssh -n \ + -o ControlPath=none \ + -o ExitOnForwardFailure=yes \ + -L "$local_socket_file:$remote_socket_file" \ + ${remote_port:+-p "$remote_port"} \ "$remote_host" \ - "x11vnc -noxrecord -nopw -ncache -ncache_cr -localhost -display ${remote_display}" & - pid=$! - sleep 1 # surrender race - if [ "$NOTIGER" ] - then - xtightvncviewer -encodings "copyrect tight zrle hextile" localhost:0 - else - xtigervncviewer localhost:0 - fi - kill $pid + "x11vnc -noxrecord -q -nopw -ncache -ncache_cr -display $local_display -unixsock $remote_socket_file -rfbport 0" & + X11VNC=$! + sleep 1 + xtigervncviewer "$local_socket_file" + kill $X11VNC } atexit() -- cgit v1.2.3