From 308f2b8b8d049c702706cbc34df5f3d3b15afad9 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sat, 12 Oct 2019 00:24:05 -0400 Subject: add support for specifying ssh port --- dot/local/bin/xvnc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'dot/local') diff --git a/dot/local/bin/xvnc b/dot/local/bin/xvnc index 9bc982b..7c0159c 100755 --- a/dot/local/bin/xvnc +++ b/dot/local/bin/xvnc @@ -4,7 +4,10 @@ direct_connection() { port=$((5900 + local_display)) ssh -o ControlPath=none -n \ - -L $port:localhost:$port "$remote_host" "x11vnc -nopw -ncache -ncache_cr -localhost -display ${remote_display}" & + -L $port:localhost:$port \ + ${remote_port+-p $remote_port} \ + "$remote_host" \ + "x11vnc -nopw -ncache -ncache_cr -localhost -display ${remote_display}" & pid=$! sleep 1 # surrender race xvncviewer -encodings "copyrect tight zrle hextile" localhost:0 @@ -13,7 +16,7 @@ direct_connection() quietly() { - "$@" >/dev/null 2>&1 + "$@" # >/dev/null 2>&1 } reverse_connection() @@ -22,7 +25,9 @@ reverse_connection() xvncviewer -fullscreen -encodings "copyrect tight zrle hextile" -listen & pid=$! quietly ssh -o ControlPath=none \ - -R $port:localhost:$port "$remote_host" \ + -R $port:localhost:$port \ + ${remote_port+-p $remote_port} \ + "$remote_host" \ "x11vnc -q -nopw -localhost -display ${remote_display} -coe localhost:$port -rfbport 0" kill $pid } @@ -35,7 +40,9 @@ share_display() ssh -o ControlPath=none \ -o ExitOnForwardFailure=yes \ -f \ - -L $port:localhost:$port "$remote_host" \ + -L $port:localhost:$port \ + ${remote_port+-p $remote_port} \ + "$remote_host" \ "fuser -vk $port/tcp; DISPLAY=${remote_display} xvncviewer -fullscreen -encodings 'copyrect tight zrle hextile' -listen" trap "fuser -vk $port/tcp" INT sleep 1 @@ -51,6 +58,10 @@ else fi remote_host=${1:-blackboard} + +remote_port=${remote_host##*:} +remote_host=${remote_host%:*} + remote_display=${2:-:0} local_display=${3:-:0} -- cgit v1.2.3