#!/bin/bash dependency_check(){ for DEPENDENCY; do if ! command -v "$DEPENDENCY" 1>/dev/null; then printf "%s not found. Please install it.\n" "$DEPENDENCY" >&2 exit 2 fi done unset DEPENDENCY } dependency_check arandr x11vnc xrandr gtf read -p'Enter client width: ' CLIENT_WIDTH read -p'Enter client heigh: ' CLEINT_HEIGHT read -p'Enter client refresh rate: ' REFRESH_RATE MODELINE=$(gtf $CLIENT_WIDTH $CLEINT_HEIGHT $REFRESH_RATE | grep Modeline | sed 's/Modeline//') #resolution of client machine (width, height, refreshrate) RESOLUTION=$(echo $MODELINE | awk '{print $2}') echo "---------------" echo $MODELINE echo "---------------" read -p 'enter the above Modeline: ' MODELINE xrandr --newmode $MODELINE echo Checking avaible ports.. echo "---------------" xrandr | grep disconnected | awk '{print $1}' echo "---------------" read -p'Enter one of the ports to be used for VNC: ' PORT xrandr --addmode $PORT $RESOLUTION xrandr --output $PORT --mode $RESOLUTION echo Configure the new diplay where you want sleep 3 arandr >> /dev/null GEO=$(xrandr | grep HDMI-A-3 | awk '{print $3}') echo Starting VNC Server sleep 3 x11vnc -cli $GEO