aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/vnc
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/vnc')
-rwxr-xr-x.local/bin/vnc30
1 files changed, 30 insertions, 0 deletions
diff --git a/.local/bin/vnc b/.local/bin/vnc
new file mode 100755
index 0000000..1af953f
--- /dev/null
+++ b/.local/bin/vnc
@@ -0,0 +1,30 @@
+#!/bin/sh -eu
+
+host="$1"
+address="$host.internal"
+
+. "$HOME/.vnc/keys/macs"
+
+[ "$host" = 'hound' ] && wol "$hound";
+[ "$host" = 'tiger' ] && wol "$tiger";
+
+notify-send -t 2000 Connecting...;
+
+i=0;
+until ping -c1 "$address" > /dev/null 2>&1;
+do notify-send -t 2000 'Waiting for response...';
+ i=$((i+1)); [ "$i" -gt 5 ] && notify-send -u critical 'Unable to negotiate connection.' && exit;
+done;
+
+notify-send -t 4000 Connected.;
+
+vncviewer -passwd "$HOME/.vnc/keys/passwd-$host" \
+ AlertOnFatalError=0 \
+ AutoSelect=0 \
+ CompressLevel=0 \
+ DotWhenNoCursor=1 \
+ Fullscreen=1 \
+ PreferredEncoding=Hextile \
+ QualityLevel=6 \
+ Shared=1 \
+ "$address:5901";