#!/bin/bash # ══════════════════════════════════════════════════ # THE Z AI — Computer Mode Startup Script # Starts: Virtual Display → Desktop → Python API # ══════════════════════════════════════════════════ echo "🖥️ Starting Z Computer Mode Server..." # ── 1. Start Virtual Display (1920x1080, 24-bit color) ── Xvfb :1 -screen 0 1920x1080x24 -ac +extension GLX +render -noreset & XVFB_PID=$! echo "✅ Xvfb started (PID: $XVFB_PID)" sleep 2 # ── 2. Start Fluxbox window manager ────────────────── export DISPLAY=:1 fluxbox & FLUX_PID=$! echo "✅ Fluxbox started (PID: $FLUX_PID)" sleep 1 # ── 3. Set wallpaper color (dark) ──────────────────── xsetroot -solid "#0d0d0d" &>/dev/null || true # ── 4. Launch Firefox (ready for browsing tasks) ───── firefox --no-sandbox --display=:1 &>/dev/null & echo "✅ Firefox launched" sleep 2 # ── 5. Create Xauthority file (required by pyautogui/Xlib) ── export XAUTHORITY=/home/zai/.Xauthority touch $XAUTHORITY xauth generate :1 . trusted 2>/dev/null || true echo "✅ Xauthority ready" # ── 6. Start Python WebSocket API Server ───────────── echo "🚀 Starting Python API on port ${PORT:-7860}..." cd /app exec python3 app.py