summaryrefslogtreecommitdiff
path: root/dot/local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'dot/local/bin')
-rwxr-xr-xdot/local/bin/xvnc33
1 files changed, 33 insertions, 0 deletions
diff --git a/dot/local/bin/xvnc b/dot/local/bin/xvnc
new file mode 100755
index 0000000..951c079
--- /dev/null
+++ b/dot/local/bin/xvnc
@@ -0,0 +1,33 @@
1#!/bin/sh
2remote_host=${1:-blackboard}
3remote_display=${2:-:0}
4local_display=${3:-0}
5
6direct_connection()
7{
8 port=$((5900 + local_display))
9 ssh -o ControlPath=none -n \
10 -L $port:localhost:$port "$remote_host" 'x11vnc -nopw -ncache -ncache_cr -localhost -display :0' &
11 pid=$!
12 sleep 1 # surrender race
13 xvncviewer -encodings "copyrect tight zrle hextile" localhost:0
14 kill $pid
15}
16
17reverse_connection()
18{
19 port=5500
20 xvncviewer -fullscreen -encodings "copyrect tight zrle hextile" -listen &
21 pid=$!
22 ssh -o ControlPath=none \
23 -R $port:localhost:$port "$remote_host" \
24 "x11vnc -nopw -localhost -display ${remote_display} -coe localhost:$port -rfbport 0" \
25 >/dev/null 2>&1
26 kill $pid
27}
28
29if [ "$USE_DIRECT_CONNECTION" ]; then
30 direct_connection
31else
32 reverse_connection
33fi