Skip to content

Instantly share code, notes, and snippets.

@jchv
Created August 28, 2025 22:30
Show Gist options
  • Select an option

  • Save jchv/8c8232cdaf1f1553987cf50fd378903c to your computer and use it in GitHub Desktop.

Select an option

Save jchv/8c8232cdaf1f1553987cf50fd378903c to your computer and use it in GitHub Desktop.
Runs a secondary XWayland display as fullscreen confined to one specified output. Use `wayland-info` to find information about connected displays, including the display name. Usage: `./xwayland-display.sh eDP-1 1920x1080 <command>`
#!/bin/bash
set -euo pipefail
XWAYLAND_DISPLAY=:69
WAYLAND_OUTPUT="$1"
shift
GEOMETRY="$1"
shift
APP_COMMAND="$@"
echo "Starting XWayland on display '$XWAYLAND_DISPLAY' for output '$WAYLAND_OUTPUT' with geometry '$GEOMETRY'..."
Xwayland "$XWAYLAND_DISPLAY" -fullscreen -geometry "$GEOMETRY" -output "$WAYLAND_OUTPUT" &
XWAYLAND_PID=$!
trap 'echo "Stopping dedicated XWayland (PID: $XWAYLAND_PID)..."; kill "$XWAYLAND_PID"' EXIT
sleep 0.5
echo "Launching application:" "${@}"
QT_QPA_PLATFORM="xcb" WAYLAND_DISPLAY= DISPLAY="$XWAYLAND_DISPLAY" "${@}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment