Skip to content

Add scrolling capture of the window under the cursor - #2097

Closed
x1xhlol wants to merge 2 commits into
CapSoftware:mainfrom
x1xhlol:feat/scrolling-capture
Closed

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

Conversation

@x1xhlol

@x1xhlol x1xhlol commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds scrolling capture: a new hotkey action ("Scrolling capture of window under cursor", unbound by default) that captures an entire scrollable window — not just the visible part — by scrolling it and stitching the frames into one tall screenshot, saved as a normal Cap screenshot project.

How it works (scrolling_capture.rs):

capture window frame
loop (≤60 steps, ≤16000px):
    inject 2 wheel notches at the cursor (SendInput on Windows,
    CGEventCreateScrollWheelEvent2 on macOS) → wait 600ms for
    smooth-scroll to settle → capture next frame
    → detect vertical offset: minimal mean-absolute-difference over
      overlapping rows (top 20% skipped for sticky headers, ≥25%
      overlap required, 1px granularity)
    → offset == 0 (bottom reached) or no match → stop
    → append the frame's new bottom rows to the stitched image
  • The hotkey targets the window under the cursor (same pattern as the existing "Screenshot current window" action), so the injected wheel events reach the right window.
  • The stitched image goes through the normal screenshot-project save path: same toast, automations, editor-open behavior, library entry.
  • No new dependencies; the stitching is a few dozen lines over image buffers.
  • Known cosmetic limitation: sticky side columns (e.g. Wikipedia's TOC panel) repeat down the image — only top-anchored sticky content is compensated.

Showcase

A 60-section page captured into one 1280x7404 image:

Stitched 7404px-tall capture

Bottom of the stitch — capture stops at the page footer with no repeated content:

Footer reached, no repeats

Testing (Windows, end-to-end on a live dev build)

Test Result
60-section long page → 1280x7404 stitch, all sections in order, zero seam artifacts ✅
Stops at page bottom (footer present, nothing repeated) ✅
Wikipedia article → 1280x12680 continuous stitch (hit the 60-frame cap on a very long article) ✅
Non-scrolling window → single frame in ~5s, no hang ✅
Toast + normal .cap screenshot project on every run ✅
Regression: normal screenshot flow unaffected ✅

macOS compiles the same capture/stitch path with a CoreGraphics scroll-event injector; runtime-tested on Windows only.

Builds on #2095 (OCR text capture — shares its capture/save helpers); the scrolling-capture change itself is the top two commits.

RetriggerConfidence Score: 5/5

The PR appears safe to merge because no blocking failure remains from the previously reported issues.

Summary

The PR adds scrolling window capture on Windows and macOS, saving stitched output through the existing screenshot-project workflow.

  • Adds platform-native wheel-event injection and frame stitching with bounded frame and output-height limits.
  • Adds the scrolling-capture hotkey action and hides it on unsupported Linux builds.
  • Includes OCR capture and related picker, settings, hotkey, and generated command-binding changes inherited from the prerequisite work.

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

Comment thread apps/desktop/src/utils/tauri.ts Resolved
@richiemcilroy

Copy link
Copy Markdown
Member

This depends on #2095 and conflicts with main. Please rebase, address the remaining Greptile concerns, and re-trigger it. We need Greptile 5/5 on the latest commit and green CI before we review.

@devin-ai-integration
devin-ai-integration Bot force-pushed the feat/scrolling-capture branch from 77f62ac to 3017862 Compare October 7, 2026 07:24
@x1xhlol

x1xhlol commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@x1xhlol

x1xhlol commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Hey, 5/5 now

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks so much for this contribution, @x1xhlol! Cap's desktop app has now fully moved from Tauri to our new native GPUI app (apps/desktop-gpui), which ships as Cap from 0.6.1 on macOS, Windows and Linux. This PR only changes the old Tauri app (apps/desktop), so it no longer affects what we ship, and I'm closing it. If the change still makes sense for the GPUI app, we'd love a PR against apps/desktop-gpui. Really appreciate the time you put into this.

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