Skip to content

Add automatic session recording - #303

Draft
milan483 wants to merge 13 commits into
splitshotz:mainfrom
milan483:milan/session-auto-recording
Draft

milan483 wants to merge 13 commits into
splitshotz:mainfrom
milan483:milan/session-auto-recording

Conversation

@milan483

@milan483 milan483 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Vice can now automatically record a full game session, similar to Medal’s Long Recording: start when a game is detected, mark highlights while playing, and save when the game closes. Vice starts after it detects a recognized game window and stops five seconds after the original game process exits.

Start session when a game is detected and Stop session when the game exits are separate options under Settings → Recording. Both default to off. Already-running and background games can trigger recording. A manual stop keeps that game instance stopped, even after restarting Vice, and another game cannot replace an active session.

Steam’s installed-app lookup can also recognize non-game software. An optional process exclusion list is proposed separately in #306.

Testing

  • On KDE Plasma Wayland, automated startup tests with native Project Zomboid and Proton Rain World verified automatic start, continued recording through minimize/restore, normal exit, and automatic finalization. Both saved videos decoded fully and retained their game tags and highlights. Earlier isolated tests verified that manual-stop suppression survives a Vice restart and that relaunching the game allows recording again.
  • Before the process-exclusion follow-up, full discovery ran 1,130 tests: 1,124 passed, four skipped, and two failed. The remaining failures, involving AV1 selection and default Chromium flags, also reproduce on upstream main.
  • TypeScript checking, locale checks, and the UI build passed.
  • Follow-up testing on the Exclude processes from automatic session recording #306 build passed an automated XFCE/X11 VM smoke test using ffmpeg and an installed Flatpak test using portal capture. Both verified process exclusions, automatic start/finalization, tags/highlights, and full video decoding. X11 sample frames passed automated non-black checks; host-side visual inspection was unavailable. Physical-GPU X11 gaming and audio were not tested.
  • Default screen/KMS capture with the per-user GPU Screen Recorder Flatpak remains blocked by a missing system KMS proxy. Running the recorder independently reproduced that failure; the portal configuration passed.

@milan483
milan483 marked this pull request as ready for review November 16, 2026 07:57

@splitshotz splitshotz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, it's a lot of careful work, and CI is green. I ran it merged onto main with a real process standing in for a game: start, stop after exit, the kept file, and the manual-stop memory surviving a restart all worked. Three things need fixing before I can merge it.

Needs fixing:

  1. One failed window scan at a manual stop turns auto-start off until Vice restarts. _change_session sets the "state" error, that sets _auto_start_state_blocked, and nothing ever clears it. I reproduced it: manual session, one scan_game_windows returning None at the stop, and after that a running game never starts a session, even after switching the setting off and on. A damaged or old-version session_auto_start.json does the same on every start, because the file is never rewritten. A failed scan should mean "suppress nothing", the block should clear on the next successful save or when the setting is toggled, and an unreadable state file should be logged and replaced with an empty one.

  2. The KDE adapter changes for everyone, including people who never turn this on. _get_active_window_kde now makes three kdotool calls instead of two, and when kdotool finds no window it returns the X11 answer instead of None. On main that None goes to the visible-window scan. XWayland's idea of focus on KDE is often stale, so this can tag a clip, set Discord presence or block a hotkey for a window that isn't focused. Please take it out of this PR. If it fixes something real, send it separately with the case it fixes.

  3. The KDE scan needs kdotool 0.3.0. kdotool kwinscript --inline was added in 0.3.0 (September) and doesn't exist in 0.2.2. On the older one, every 2 second tick runs a kdotool that fails, then falls back to wmctrl, which only sees XWayland windows, and Settings still says the feature is supported. Please probe for it once, cache the answer, and report it as unavailable when it's missing.

Smaller:

  1. _scan_x11_game_windows treats "wmctrl ran and listed nothing" as "no games". list_candidate_windows on main falls back to xdotool in that case. On Hyprland here wmctrl lists 0 windows while xdotool sees 71.
  2. The xdotool fallback runs two processes per window every 2 seconds. With 71 windows that's about 140 spawns per tick. It needs a cheaper path or a slower interval when it's on the fallback.
  3. With both settings off, every session start logs "Automatic session stopping is off.", and the detection-failure message now says "automatic stopping unavailable" even when the feature is off. Please keep the off case as quiet as it is on main.
  4. The copy is too long for Settings. Each help line should be one short sentence about what the switch does, without how it works inside ("the game process that was active when the session started", the list of desktops). The three error notes and sessionAutoStartFailedDetail need the same treatment.
  5. A game that starts through a launcher splits the session: the window's first process exits while the game keeps running, the session stops after 5 seconds and a second one starts. Both files are kept, so nothing is lost, but it should follow the process tree or at least be a documented limit.

Mine to decide, no action needed from you yet:

  • It's unavailable on Hyprland, Sway and Niri, and the switch is still offered there and only says so after saving. I'd want it disabled up front on those, like "Follow mouse" is, or scanners for them (hyprctl clients -j and swaymsg -t get_tree would do it).
  • With only "start" on, a session keeps recording the desktop after the game closes. I lean towards a session that Vice started always stopping with its game.
  • After an automatic stop, a double-tap out of habit starts a new session.

I'll look at #306 again once this is in, since it sits on top.

Remove redundant information about automatic session stopping.
Repair owned unreadable suppression files through the existing atomic save path while retaining known identities and diagnostic backups. Keep transient storage errors fail-closed.

Skip manual-stop discovery and persistence when automatic starts are disabled, including changes while scanning or awaiting the persistence lock. Add normal-user permission and concurrency regression coverage.
@milan483
milan483 marked this pull request as draft November 18, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants