#!/usr/bin/env bash set -euo pipefail export DISPLAY=${DISPLAY:-:0} SCREEN_W=${SCREEN_W:-1366} SCREEN_H=${SCREEN_H:-768} SCREEN_D=${SCREEN_D:-24} PORT=${PORT:-7860} # Start a virtual X server Xvfb "$DISPLAY" -screen 0 "${SCREEN_W}x${SCREEN_H}x${SCREEN_D}" -ac +extension GLX +render -noreset & sleep 2 # Start a dbus session eval "$(dbus-launch --sh-syntax)" # Start XFCE desktop session if command -v xfce4-session >/dev/null 2>&1; then xfce4-session >/tmp/xfce.log 2>&1 & else startxfce4 >/tmp/xfce.log 2>&1 & fi # Expose via VNC x11vnc -display "$DISPLAY" -nopw -forever -shared -rfbport 5900 -rfbwait 120000 >/tmp/x11vnc.log 2>&1 & # Serve noVNC on $PORT NOVNC_WEB=/usr/share/novnc websockify --web="${NOVNC_WEB}" "${PORT}" localhost:5900 >/tmp/websockify.log 2>&1 & echo "------------------------------------------------------" echo "noVNC is live on port ${PORT} (Hugging Face URL)." echo "Zed will auto-launch inside the XFCE session." echo "Logs: /tmp/xfce.log /tmp/x11vnc.log /tmp/websockify.log" echo "------------------------------------------------------" wait -n || true tail -f /tmp/xfce.log /tmp/x11vnc.log /tmp/websockify.log || true