Skip to content

feat: scrolling capture of the window under the cursor in the GPUI app - #3240

Open
x1xhlol wants to merge 2 commits into
CapSoftware:mainfrom
x1xhlol:devin/gpui-scrolling-capture
Open

x1xhlol wants to merge 2 commits into
CapSoftware:mainfrom
x1xhlol:devin/gpui-scrolling-capture

Conversation

@x1xhlol

@x1xhlol x1xhlol commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

GPUI port of #2097, stacked on the GPUI OCR capture PR (it includes that commit and only adds one more on top).

New HotkeyAction::ScrollingCaptureWindow (scrollingCaptureWindow, no default binding). It targets devices::topmost_foreign_window_at_cursor() and runs scrolling_capture::capture_scrolling_window:

frame0 = capture(window)
loop up to 60 frames:
  inject_scroll(-2 notches); sleep 600ms; frame = capture(window)
  stop if size changed, no overlap match (find_scroll_offset, mean abs diff <= 12), offset 0, or 16k px height cap
  append bottom `offset` rows
write_screenshot_bundle(stitched) -> screenshot_finished(png)

Scroll injection uses SendInput with MOUSEEVENTF_WHEEL on Windows and CGEventCreateScrollWheelEvent2 on macOS. Linux logs a warning and the Shortcuts row is hidden there. A static bottom band (fixed footer) is detected between frames, excluded from matching and stitching, and appended once at the end. Capture stops if the pointer leaves the target window, and a second invocation while one is running is ignored. The result goes through the normal post-screenshot behaviour (editor or copy).

find_scroll_offset has unit tests for a known offset, identical frames, and unrelated frames.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with one non-blocking issue in how the main window returns after cancelling OCR through the dock icon.

Summary

Adds scrolling window capture and the stacked OCR capture feature to the GPUI app.

  • OCR copies text from a drawn area into the clipboard.
  • Scrolling capture joins the window under the pointer into one tall screenshot.
  • Settings window formatting changes without changing what it does.

Reviews (5) · Last reviewed commit: "Add scrolling capture of the window unde..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

@x1xhlol is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread apps/desktop-gpui/src/settings_pages.rs Resolved
Comment thread apps/desktop-gpui/src/ocr.rs Resolved
@richiemcilroy

Copy link
Copy Markdown
Member

Thanks @x1xhlol! This is stacked on #3238, so it can only merge after that one does.

It needs a 5/5 from Greptile on its latest commit and green CI before we can merge. It's at 2/5 with three P1s:

  • Fixed footers replace the captured content when frames are stitched. Sticky headers and footers need to be detected and kept out of the overlap matching.
  • Scrolling follows the wrong window. The scroll events have to go to the window that was under the cursor when the capture started, even if focus or the cursor moves afterwards.
  • Text capture always fails on Linux. The same fix as feat: global OCR text capture in the GPUI app (Ctrl/Cmd+Shift+T) #3238 applies: only seed and show it on macOS and Windows.

Once #3238 is in and these are fixed, rebase onto main and request a re-review.

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/gpui-scrolling-capture branch 2 times, most recently from 0dd15a0 to 1a37cad Compare October 25, 2026 12:18
@x1xhlol

x1xhlol commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/gpui-scrolling-capture branch 2 times, most recently from eb5640a to 907e398 Compare October 25, 2026 12:52
@x1xhlol

x1xhlol commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread apps/desktop-gpui/src/app_windows.rs Resolved
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/gpui-scrolling-capture branch from 907e398 to c0a56b9 Compare October 25, 2026 14:23
@x1xhlol

x1xhlol commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread apps/desktop-gpui/src/app_windows.rs Resolved
@greptile-apps

greptile-apps Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/gpui-scrolling-capture branch from c0a56b9 to 83aa2d1 Compare October 25, 2026 14:51
@x1xhlol

x1xhlol commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff

These findings could not be posted inline.

  • P2 Main window stays hidden apps/desktop-gpui/src/app_windows.rs:2235 ▶

    close_target_overlays now leaves ocr_restore.pending set when the dock icon cancels an OCR picker. Open OCR while the main window is hidden, click the dock icon, then take an area screenshot with copy/save-only selected. The pending state prevents the new picker from remembering that the main window is now visible. Screenshot completion uses the old false value and leaves it hidden.

    Clear the pending restore state when explicitly reopening the main window, while keeping capture preparation from restoring it early.

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks! Can you resolve the conflicts with main? Then we'll take a look.

This branch has not been deployed

No deployments
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