Default the x11 headless desktop to GNOME (Openbox still opt-in)

Bare Openbox rendered only a blank slate root — usable but not the
desktop wanted. Make the X11/NVENC capture path render a full GNOME
session by default, with Openbox available via HEADLESS_DESKTOP=openbox
for minimal/low-power hosts.

- files/headless-desktop-gnome.service: full Ubuntu GNOME session forced
  onto the X11 path (XDG_SESSION_TYPE=x11, no dbus-run-session so it
  shares the systemd user bus). Renamed the Openbox unit to
  headless-desktop-openbox.service.
- lib/headless.sh: HEADLESS_DESKTOP (default gnome) selects the unit
  template + the packages to install (gnome-session/gnome-shell vs
  openbox/xsetroot).
- install.sh: step message + usage document HEADLESS_DESKTOP.
- status.sh: the :0 desktop check now reports which desktop is running
  (reads _NET_WM_NAME off the supporting-wm-check window, e.g.
  "GNOME Shell").
- docs: TROUBLESHOOTING §13 + FOLLOWUPS P3 updated for the GNOME default
  and the openbox toggle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 23:56:17 +00:00
parent 6fc34a2bd2
commit 84ddf8c1c6
7 changed files with 96 additions and 27 deletions

View File

@@ -186,15 +186,19 @@ case "${CAP:-}" in
# yet have no WM/desktop drawing anything — Sunshine then captures an empty
# black root window (pairing/NVENC/input all work; client sees only black).
if command -v xprop >/dev/null 2>&1; then
wm_check=$( (if [[ $EUID -eq 0 && "$SUSER" != "$(id -un)" ]]; then sudo -u "$SUSER" DISPLAY=:0 xprop -root _NET_SUPPORTING_WM_CHECK; else DISPLAY=:0 xprop -root _NET_SUPPORTING_WM_CHECK; fi) 2>/dev/null)
if grep -q 'window id' <<<"$wm_check"; then
pass "a window manager is running on :0 (something to capture)"
_xp(){ if [[ $EUID -eq 0 && "$SUSER" != "$(id -un)" ]]; then sudo -u "$SUSER" DISPLAY=:0 xprop "$@"; else DISPLAY=:0 xprop "$@"; fi; }
wm_win=$(_xp -root _NET_SUPPORTING_WM_CHECK 2>/dev/null | grep -o '0x[0-9a-f]*' | head -1)
if [[ -n $wm_win ]]; then
# Read the WM's advertised name (e.g. "GNOME Shell", "Openbox") so the
# report says which desktop is actually rendering, not just that one is.
wm_name=$(_xp -id "$wm_win" _NET_WM_NAME 2>/dev/null | sed -n 's/.*= "\(.*\)"/\1/p')
pass "a desktop is running on :0${wm_name:+ (${wm_name})} — something to capture"
else
fail "no window manager on :0 — capture will be a black screen" \
"Start a desktop on the headless Xorg: 'systemctl --user enable --now headless-desktop.service' (install.sh installs it for the x11 backend). See TROUBLESHOOTING.md §13."
"Start a desktop on the headless Xorg: 'systemctl --user enable --now headless-desktop.service' (install.sh installs it for the x11 backend; HEADLESS_DESKTOP=gnome|openbox). See TROUBLESHOOTING.md §13."
fi
else
note "xprop not installed — skipping window-manager-on-:0 check (install x11-utils to enable it)"
note "xprop not installed — skipping desktop-on-:0 check (install x11-utils to enable it)"
fi
# wlr env leaking into an x11 unit (stale sway drop-in — TROUBLESHOOTING §13)
if [[ -n $UNIT ]]; then