Files
q-tools/vnc/vnc_functions
2013-09-17 15:42:10 +03:00

28 lines
577 B
Plaintext

function get_vnc() {
# USAGE:
# get_vnc
# do_your_X11_stuff
# kill_vnc
local i
for ((i=0;$i<60;i++)); do
vncserver :$i -depth 24 -geometry 1024x768 -geometry 800x600 -geometry 1366x768 -geometry 1280x1024 -geometry 1680x1050 2>&1
if [ $? -eq 0 ]; then
VNCDISPLAY=$i
export DISPLAY=:$i
VNCPORT=$(( 5900 + $i ))
echo DISPLAY=$DISPLAY
echo VNCPORT=$VNCPORT
return 0
fi
done
# failed to start
return 1
}
function kill_vnc() {
vncserver -kill $DISPLAY
}