diff options
Diffstat (limited to 'dot')
-rwxr-xr-x | dot/local/bin/xvnc | 19 |
1 files changed, 15 insertions, 4 deletions
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() | |||
4 | { | 4 | { |
5 | port=$((5900 + local_display)) | 5 | port=$((5900 + local_display)) |
6 | ssh -o ControlPath=none -n \ | 6 | ssh -o ControlPath=none -n \ |
7 | -L $port:localhost:$port "$remote_host" "x11vnc -nopw -ncache -ncache_cr -localhost -display ${remote_display}" & | 7 | -L $port:localhost:$port \ |
8 | ${remote_port+-p $remote_port} \ | ||
9 | "$remote_host" \ | ||
10 | "x11vnc -nopw -ncache -ncache_cr -localhost -display ${remote_display}" & | ||
8 | pid=$! | 11 | pid=$! |
9 | sleep 1 # surrender race | 12 | sleep 1 # surrender race |
10 | xvncviewer -encodings "copyrect tight zrle hextile" localhost:0 | 13 | xvncviewer -encodings "copyrect tight zrle hextile" localhost:0 |
@@ -13,7 +16,7 @@ direct_connection() | |||
13 | 16 | ||
14 | quietly() | 17 | quietly() |
15 | { | 18 | { |
16 | "$@" >/dev/null 2>&1 | 19 | "$@" # >/dev/null 2>&1 |
17 | } | 20 | } |
18 | 21 | ||
19 | reverse_connection() | 22 | reverse_connection() |
@@ -22,7 +25,9 @@ reverse_connection() | |||
22 | xvncviewer -fullscreen -encodings "copyrect tight zrle hextile" -listen & | 25 | xvncviewer -fullscreen -encodings "copyrect tight zrle hextile" -listen & |
23 | pid=$! | 26 | pid=$! |
24 | quietly ssh -o ControlPath=none \ | 27 | quietly ssh -o ControlPath=none \ |
25 | -R $port:localhost:$port "$remote_host" \ | 28 | -R $port:localhost:$port \ |
29 | ${remote_port+-p $remote_port} \ | ||
30 | "$remote_host" \ | ||
26 | "x11vnc -q -nopw -localhost -display ${remote_display} -coe localhost:$port -rfbport 0" | 31 | "x11vnc -q -nopw -localhost -display ${remote_display} -coe localhost:$port -rfbport 0" |
27 | kill $pid | 32 | kill $pid |
28 | } | 33 | } |
@@ -35,7 +40,9 @@ share_display() | |||
35 | ssh -o ControlPath=none \ | 40 | ssh -o ControlPath=none \ |
36 | -o ExitOnForwardFailure=yes \ | 41 | -o ExitOnForwardFailure=yes \ |
37 | -f \ | 42 | -f \ |
38 | -L $port:localhost:$port "$remote_host" \ | 43 | -L $port:localhost:$port \ |
44 | ${remote_port+-p $remote_port} \ | ||
45 | "$remote_host" \ | ||
39 | "fuser -vk $port/tcp; DISPLAY=${remote_display} xvncviewer -fullscreen -encodings 'copyrect tight zrle hextile' -listen" | 46 | "fuser -vk $port/tcp; DISPLAY=${remote_display} xvncviewer -fullscreen -encodings 'copyrect tight zrle hextile' -listen" |
40 | trap "fuser -vk $port/tcp" INT | 47 | trap "fuser -vk $port/tcp" INT |
41 | sleep 1 | 48 | sleep 1 |
@@ -51,6 +58,10 @@ else | |||
51 | fi | 58 | fi |
52 | 59 | ||
53 | remote_host=${1:-blackboard} | 60 | remote_host=${1:-blackboard} |
61 | |||
62 | remote_port=${remote_host##*:} | ||
63 | remote_host=${remote_host%:*} | ||
64 | |||
54 | remote_display=${2:-:0} | 65 | remote_display=${2:-:0} |
55 | local_display=${3:-:0} | 66 | local_display=${3:-:0} |
56 | 67 | ||