base-vnc/vnc.sh
Merith b46f9fccce
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 29s
update to use i3 instead of openbox
2025-06-05 04:38:43 +00:00

36 lines
No EOL
1.1 KiB
Bash

#!/bin/bash
# Prepare variables
: "${VNC_BUILTIN_WIDTH:=1024}"
: "${VNC_BUILTIN_HEIGHT:=786}"
: "${VNC_BUILTIN_PIXELDEPTH:=32}"
: "${VNC_BUILTIN_DISABLED:=true}"
if [ "${VNC_BUILTIN_DISABLED}" = true ]; then
echo "Builtin VNC is disabled. You must ensure the DISPLAY variable is set and the target display is accessible"
echo "Using display ${DISPLAY}"
else
echo "Builtin VNC is enabled. The DISPLAY variable will be ignored and overwritten"
export DISPLAY=":0"
echo "Using display ${DISPLAY} with size of ${VNC_BUILTIN_WIDTH}x${VNC_BUILTIN_HEIGHT} and pixel depth ${VNC_BUILTIN_PIXELDEPTH}"
Xvfb ${DISPLAY} -screen 0 "${VNC_BUILTIN_WIDTH}x${VNC_BUILTIN_HEIGHT}x${VNC_BUILTIN_PIXELDEPTH}" &
fi
# Wait for the display to become ready
while ! xdpyinfo -display "${DISPLAY}" > /dev/null 2>&1; do
echo "Waiting for display ${DISPLAY} to become ready..."
sleep 1
done
echo "Display ${DISPLAY} is ready!"
# Launch the VNC server if enabled
if [ "${VNC_BUILTIN_DISABLED}" != true ]; then
x11vnc -bg -forever -nopw -display ${DISPLAY} &
fi
# Launch i3 window manager
/usr/bin/i3
echo "i3 exited unexpectedly"
sleep infinity