fix(host/gamescope): free Steam from the autologin TV session while streaming

On a Bazzite host that autologins into gaming mode on a physical display (the F44
default: gamescope-session-plus@ogui-steam on the TV), Steam — single-instance — is
held by that session, which renders to the TV's native mode. The host-managed session
then can't start its own Steam, so it captured the TV's 4K output instead of the
client's mode (stretched). On F43 the box wasn't in gaming mode, so the host's Steam
was the only one.

Fix: on connect, the host-managed gamescope path stops any running autologin
`gamescope-session-plus@*` unit (frees Steam) before launching its own session at the
client's mode; on client disconnect (`restore_tv_session`, called from serve_session
teardown) it stops our session and restarts the autologin one, so the TV returns to
gaming mode by default when no one is streaming. Stopping the `--user` unit sticks
(Relogin only fires on the full logind session ending — verified live), so no sddm
config change is needed. Cost: a Steam cold-start per connect, given single-instance.

No-op on non-Bazzite / headless boxes (nothing to stop → nothing to restore).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-14 19:38:58 +00:00
parent 03788d2679
commit 6c803c521c
3 changed files with 86 additions and 0 deletions
+10
View File
@@ -227,6 +227,16 @@ pub fn gamescope_ei_socket_file() -> &'static str {
gamescope::EI_SOCKET_FILE
}
/// Call when a client session ends: if the host-managed gamescope path took over a box's autologin
/// gaming session (stopped its single-instance Steam to stream at the client's mode), restart that
/// session so the TV returns to gaming mode. No-op on other compositors / when nothing was taken.
#[cfg(target_os = "linux")]
pub fn restore_managed_session() {
gamescope::restore_tv_session();
}
#[cfg(not(target_os = "linux"))]
pub fn restore_managed_session() {}
#[cfg(target_os = "linux")]
mod gamescope;
#[cfg(target_os = "linux")]