Repository navigation
fix: keep the Playnite session while a game runs and follow renamed screens - #191
Merged
Merged
Conversation
…creens
Playnite hides its fullscreen window while a game it started runs
("Minimize after game startup", on in the Selene theme). After 20 s the
loop took it as closed and restored the desk mid-game. The window that
was watched still exists, hidden or minimized, so the session goes on
until the Playnite process exits.
Windows can also rename the screens during a session (the TV went in as
DISPLAY3 and came out as DISPLAY1). The start now looks the game screen
up again by its id after each display change, and the restore maps the
names saved next to the backup to the current ones by MonitorID, so it
no longer detaches a desk monitor taking it for the TV. The primary goes
back before the TV is detached (Windows refuses to detach the primary),
and only a screen still on at the end counts as a failed detach.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes This review covers the Playnite session tracking and display identity/restore changes, including their tests and manual checks.
- Playnite session tracking. The exit policy now keeps a session alive while Playnite's existing fullscreen window is hidden for a launched game, and still ends the session when the Playnite process exits.
- Display identity across transitions. Startup re-resolves the focus display after topology changes, while restore remaps saved names by monitor ID and restores the original primary before detaching displays.
- Coverage. Added unit tests cover hidden-window exit policy and swapped display names; the manual checklist documents the hardware-dependent scenarios.
gpt-6-luna | 𝕏
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Two bugs from the owner's session on 2026-11-01 (Playnite with the Selene theme, the LG TV as the game screen, both desk monitors detached):
PlayniteExitPolicytook Playnite as closed (and logged "Playnite fechou" though the process was running), so the desk came back mid-game. The window that was watched still exists (same handle, hidden and iconic) and comes back when the game ends, unlike a loading window swapped for the main one, which is destroyed. The session now goes on while that window is put away, and ends when the process exits.DISPLAY3and came out asDISPLAY1, and the HP tookDISPLAY3. The backup layout already followed monitors byMonitorID, but the names saved next to it (primary, game screen, hidden screens) did not, so the restore detachedDISPLAY3(now the HP) as "the TV". The same rename made the 1440p mode fail at the start (=> -1) and the window placement miss the TV.FollowFocusRename).DisplayIdentity.CurrentNames, tested with the owner's exact swap).Verified on the owner's PC (debug build, owner's config)
playnite://playnite/start/…) → 60 s later the session is still active; the log says "Playnite escondeu a janela (jogo aberto); a sessão continua". Before the fix, the same steps restored the desk 20 s after the game started.dotnet test: 675 passing. Manual checks added todocs/TESTING.md.🤖 Generated with Claude Code