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:
@@ -64,11 +64,11 @@ class SpiceDisplayEnabler:
|
||||
print(f"Setting display {i}: {self.width}x{self.height} at ({x}, {y})")
|
||||
|
||||
try:
|
||||
# Enable the display
|
||||
self.main_channel.set_display_enabled(i, True)
|
||||
# Enable the display using update_display_enabled (not set_display_enabled)
|
||||
self.main_channel.update_display_enabled(i, True, False)
|
||||
|
||||
# Set display geometry (id, x, y, width, height)
|
||||
self.main_channel.set_display(i, x, y, self.width, self.height)
|
||||
# Set display geometry (id, x, y, width, height) using update_display
|
||||
self.main_channel.update_display(i, x, y, self.width, self.height, False)
|
||||
except Exception as e:
|
||||
print(f" Error setting display {i}: {e}")
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
share-clipboard=true
|
||||
|
||||
[fallback]
|
||||
monitor-mapping=1:0;2:1;3:2
|
||||
monitor-mapping=1:1;2:2;3:3
|
||||
|
||||
Reference in New Issue
Block a user