#!/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";