File size: 1,161 Bytes
020ba92
 
 
 
 
 
 
 
 
 
 
f19f250
020ba92
f19f250
020ba92
 
f19f250
020ba92
 
 
 
 
 
f19f250
020ba92
 
f19f250
020ba92
 
 
 
f19f250
020ba92
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/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