Sidl - small script to see monitors you can't look at

Hi,

This script brings up a small VNC window for showing you screens connected but not in line of sight, it uses x11vnc and xtightvncviewer, and doesn't leave anything running all the time. You cannot interact with the VNC window, have to move the pointer to that screen, but at least when you do you'll be able to see it. If you run it without specifying a screen it'll show you a list.

#!/bin/bash
#
# VNC Server
VNCSERVER=x11vnc
# Scale the display
VNCSCALE=0.7
# Default: x11vnc -q --display :0 --viewonly --localhost -noscr -nowcr -nopw
VNCOPTS="-q --viewonly --localhost --noscr --nowcr --nopw"
#
# Screen to display
SIDE="HDMI-0"
#
# The startup position of the vncviewer window, can also
# set size, but not all viewers will scale
VIEWPOS=+0+0
#VIEWPOS="+2560+0" # Start in the top right corner of the 2nd screen
#VIEWPOS="+640+360" # Left side of first screen (1280x720 screen)
#
# Viewer binary, only xtightvncviewer displayed cursor so far
VIEWER="xtightvncviewer -nocursorshape"


if [ -z $1 ]
then
  echo -e "Specify physical port for display, here is some info on your displays: \n"
  xrandr -q | grep -v "   "
  exit 1
fi

CLIP=$(xrandr | grep $1 | cut -f 3 -d " ")


$VNCSERVER $VNCOPTS --clip $CLIP --scale $VNCSCALE &
echo "waiting for x11vnc to start"
while ! $(nc -z -v localhost 5900); do echo "NC" ; sleep 0.5 ; done
echo "launching viewer"
$VIEWER -geometry $VIEWPOS localhost
1 Like