#!/bin/bash
# Runs the given command against a headless Weston compositor, mirroring xvfb-run's ergonomics
# for Wayland. Usage: weston-run <command> [args...]
weston --backend=headless-backend.so --shell=kiosk-shell.so --socket=wayland-headless &
WESTON_PID=$!
sleep 1
WAYLAND_DISPLAY=wayland-headless "$@"
STATUS=$?
kill "$WESTON_PID" 2>/dev/null
wait "$WESTON_PID" 2>/dev/null
exit "$STATUS"
