From f4200b6a695b010169d18e9d84dcd26bed02b7ad Mon Sep 17 00:00:00 2001 From: Connor Johnstone Date: Mon, 14 Sep 2026 16:01:48 -0400 Subject: [PATCH] Make the headless session actually usable over the stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two reasons both Sunshine apps streamed a blank screen. Steam is an X client, and sway starts Xwayland lazily. DISPLAY therefore did not exist at the moment the config imported the environment for Sunshine, so Steam came up with "Unable to open a connection to X" and rendered nothing. `xwayland force` starts it at compositor launch instead, and DISPLAY joins the import. The Desktop app was not broken at all — the desktop was genuinely empty. swaybg was painting #101920 on an output with no windows and no bar, which over a stream is indistinguishable from a failed capture. There are now keybinds for a terminal and a launcher, and kitty starts with the session so a working capture looks obviously working. Verified: Xwayland on :0, DISPLAY exported, xdpyinfo and zenity connect, and Steam Big Picture Mode renders as a window on HEADLESS-1. --- hosts/mainframe/sway/headless.conf | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/hosts/mainframe/sway/headless.conf b/hosts/mainframe/sway/headless.conf index 705177e..38a2455 100644 --- a/hosts/mainframe/sway/headless.conf +++ b/hosts/mainframe/sway/headless.conf @@ -8,15 +8,28 @@ output HEADLESS-1 mode 1920x1080@60Hz position 0,0 output HEADLESS-1 background #101920 solid_color -# Sunshine is a systemd user unit, so it needs WAYLAND_DISPLAY in the user -# manager's environment. Import it before starting Sunshine, not after. -exec systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP +# Start Xwayland eagerly rather than on first X client. Steam is an X app, and +# with the default lazy start DISPLAY does not exist yet when the line below +# imports the environment — so Steam launched by Sunshine got +# "Unable to open a connection to X" and showed a blank stream. +xwayland force + +# Sunshine is a systemd user unit and inherits nothing from this session, so +# hand it the display variables before starting it. +exec systemctl --user import-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP exec systemctl --user start sunshine.service -# Nothing is attached to this session locally, so keybinds are only useful -# through a Moonlight client. Keep the set minimal. +# Input arrives from the Moonlight client, so keybinds are worth having even +# though nobody is sitting at this machine. Without them the Desktop app +# streams an empty screen with no way to open anything. set $mod Mod4 +bindsym $mod+Return exec kitty +bindsym $mod+d exec wofi --show drun bindsym $mod+Shift+q kill bindsym $mod+Shift+e exec swaymsg exit +# Something visible on login, so a working capture is obviously working rather +# than indistinguishable from a broken one. +exec kitty + # No bar, no idle daemon, no lock screen — there is no one sitting here.