feat: add per-window capture source selection - #136
Conversation
Allow users to record a specific application window instead of the entire desktop. Adds a unified 'Capture source' selector in Settings that lists both monitors and application windows. Backend changes: - Add list_capture_windows() to active_window.py for X11, Hyprland, and Sway window enumeration with title, app name, and window ID - Add list_capture_sources() to recorder.py combining monitors + windows - Add list_gsr_windows() parsing gpu-screen-recorder --list-capture-options - Add _resolve_capture_source() for unified capture_source config format - Add _x11_window_geometry() for window dimension detection - Update GSR, wf-recorder, and ffmpeg backends to use capture_source - Add window capture warning for wf-recorder (unsupported) Config: - Add capture_source field to RecordingConfig (format: display:<id>, window:<id>, window:focused, or null for auto) API: - Add GET /api/capture-sources endpoint returning monitors + windows UI: - Replace Display selector with Capture source grouped dropdown (Displays optgroup + Application Windows optgroup) - Add Focused window (auto-follow) option - Add refresh button to re-scan for windows - Add .capture-source-row CSS layout All 200 existing tests pass.
|
Thanks for this, and sorry it sat so long. I'm going to close it, but I want to be specific about why, because two of the criticisms floating around aren't accurate and I don't want them attached to your work. This PR does not touch games.json and does not delete any tests. It's branched off v2.5.0, so a diff against current main makes it look that way. That isn't on you. The two things that are real:
It would take follow-my-mouse down with it. 2.6.0 added a Neither is a design problem, they're both "this needs a rebase onto 2.6.0" problems. But there's also #157 now covering the same ground, and its approach is better in one way that matters: instead of GSR's I'd rather land one implementation than merge two half-overlapping ones, so I'm consolidating on #157. Your |
Summary
Allow users to record a specific application window instead of the entire desktop. Adds a unified Capture source selector in Settings that lists both monitors and application windows.
What changed
Backend — Source Enumeration (
active_window.py)list_capture_windows()enumerates visible windows for X11 (wmctrl/xdotool), Hyprland (hyprctl clients -j), and Sway (swaymsgtree walk)Backend — Recording Pipeline (
recorder.py)list_capture_sources()combines monitors + windows into a unified list withkindfieldlist_gsr_windows()parses gpu-screen-recorder's--list-capture-optionsfor window entries_resolve_capture_source()handles the unifiedcapture_sourceconfig format_gsr_capture_target()to pass window IDs to GSR's-wflag_ffmpeg_x11_input_args()to capture specific windows by geometry viaxwininfo_x11_window_geometry()for window dimension detectionConfig (
config.py)capture_sourcefield onRecordingConfig— format:"display:<id>","window:<id>","window:focused", ornullfor autodisplayfield still works whencapture_sourceis not setAPI (
share.py)GET /api/capture-sourcesendpoint returning monitors + windows withkindandlabelUI (
index.html,settings.js,state.js,settings.css)<optgroup>sections: "Displays" and "Application Windows"displayconfig valuesEdge cases handled
xwininfofor ffmpeg; GSR handles internallyTesting
All 200 existing tests pass (151 recorder + 49 UI static).
Screenshots
The Capture source dropdown in Settings:
Closes #