fix(multi-display): fix runtime directory race condition and SPICE display enabling

- Fix tmpfs race condition in daemon by mounting runtime directory explicitly
  before starting Sway, preventing sockets from being hidden when systemd-logind
  mounts over them later
- Fix enable-displays.py to use correct SpiceClientGLib API methods
  (update_display_enabled/update_display instead of set_display_enabled/set_display)
- Fix virt-viewer monitor-mapping to use 1-indexed client monitors
- Add virt-viewer config setup and automatic display enabling to test script
- Multi-display now works correctly with 3 QXL devices
This commit is contained in:
2026-01-10 08:23:50 +00:00
parent 7727fafeec
commit e02b5b7046
7 changed files with 86 additions and 15 deletions

View File

@@ -116,6 +116,14 @@ if ! command -v remote-viewer &> /dev/null; then
exit 0
fi
# Set up virt-viewer settings for multi-display
VIRT_VIEWER_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/virt-viewer"
mkdir -p "$VIRT_VIEWER_CONFIG_DIR"
if [ -f "$SCRIPT_DIR/virt-viewer-settings" ]; then
cp "$SCRIPT_DIR/virt-viewer-settings" "$VIRT_VIEWER_CONFIG_DIR/settings"
echo "Configured virt-viewer for 3 displays"
fi
# Detect DISPLAY if not set
if [ -z "$DISPLAY" ]; then
# Try to find an active X display
@@ -175,18 +183,30 @@ if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then
VIEWER_PID=$!
echo "remote-viewer running headlessly (PID: $VIEWER_PID)"
else
echo "Launching remote-viewer (DISPLAY=$DISPLAY, WAYLAND_DISPLAY=$WAYLAND_DISPLAY)..."
remote-viewer spice://localhost:5930 &
echo "Launching remote-viewer with fullscreen for multi-display (DISPLAY=$DISPLAY, WAYLAND_DISPLAY=$WAYLAND_DISPLAY)..."
remote-viewer --full-screen spice://localhost:5930 &
VIEWER_PID=$!
fi
echo ""
echo "=== Press Ctrl-C to stop ==="
echo ""
# Wait for eco-vdagent to be ready in the guest, then enable all 3 displays
echo "Waiting for eco-vdagent to be ready (10s)..."
sleep 10
# Enable all 3 displays via SPICE protocol
if [ -f "$SCRIPT_DIR/enable-displays.py" ]; then
echo "Enabling all 3 displays via SPICE protocol..."
python3 "$SCRIPT_DIR/enable-displays.py" "spice://localhost:5930" 3 2>&1 || true
echo ""
fi
echo "Tips:"
echo " - View > Displays > Enable Display 2/3 for multi-monitor"
echo " - pnpm run test:screenshot - Take screenshot"
echo " - http://localhost:3006 - Management UI"
echo " - socat - UNIX-CONNECT:.nogit/vm/serial.sock - Serial console (login: ecouser/ecouser)"
echo ""
# Wait for either process to exit