#!/bin/bash : ' @vendor Chorke Academia, Inc. @web https://cdn.chorke.org/docs/academia @version 1.0.00 @since 1.0.00 ' :</dev/null # nvidia/nouveau/amdgpu device should be configured first before Intel GPU Section "Device" Identifier "nvidiagpu0" Driver "nvidia" EndSection # Then configure the Intel Internal GPU Section "Device" Identifier "intelgpu0" Driver "intel" EndSection EOF fi xrandr --addmode ${VIRTUAL_DISPLAY} ${VIRTUAL_MODE_NAME} 2>/dev/null if [[ ! $? -eq 0 ]];then echo ${VIRTUAL_MODE_NAME} ${VIRTUAL_MODE_DESC}| xargs xrandr --newmode echo ${VIRTUAL_DISPLAY} ${VIRTUAL_MODE_NAME} | xargs xrandr --addmode fi xrandr --output ${VIRTUAL_DISPLAY} --mode ${VIRTUAL_MODE_NAME} && sleep 5 xrandr --output ${VIRTUAL_DISPLAY} ${VIRTUAL_POSITION} ${PRIMARY_DISPLAY} } function launch(){ VIRTUAL_POSITION=$(xrandr|sed -n "s/^${VIRTUAL_DISPLAY}\s*connected\s*\([0-9]*x[0-9]*+[0-9]*+[0-9]*\).*/\1/p") x11vnc -multiptr -repeat -clip ${VIRTUAL_POSITION} } function finish(){ xrandr --output ${VIRTUAL_DISPLAY} --off xrandr --delmode ${VIRTUAL_DISPLAY} ${VIRTUAL_MODE_NAME} printf '%s \033[0;31mdisplay disabled \033[0m:)\n' ${VIRTUAL_DISPLAY} } trap finish EXIT function init(){ validate setting install launch } init