aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/vnc
blob: 1af953fc34fa77df6fda73b30ae1e760da0a4475 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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";