Add global OCR text capture (Ctrl/Cmd+Shift+T) - #2095
Open
x1xhlol wants to merge 7 commits into
Open
Conversation
x1xhlol
force-pushed
the
feat/ocr-text-capture
branch
from
August 6, 2026 13:44
00b2e6a to
b26aeff
Compare
…notification setting, avoid revealing main window after OCR, restore macOS diagnostics bindings
x1xhlol
force-pushed
the
feat/ocr-text-capture
branch
from
August 6, 2026 13:55
ce81b7b to
6ecef8b
Compare
This was referenced Aug 6, 2026
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.
Summary
Adds a privacy-first "copy text from screen" feature: press Ctrl+Shift+T (Windows) / Cmd+Shift+T (macOS), drag over any screen region with the existing area selector, and the recognized text is copied straight to the clipboard. Nothing is written to disk by default.
Reuses Cap's existing native OCR engines (Apple Vision on macOS, Windows.Media.Ocr on Windows) — no new dependency, free, fast, on-device.
How it fits together:
HotkeyAction::OcrArea— new hotkey action, seeded with a default binding on startup viaseed_default_hotkeys(aseededlist inHotkeysStoreensures it's only auto-added once and never overrides a user's existing binding). Pressing it opens the target-select overlay in a newRecordingTargetMode::Ocr.target-select-overlay.tsx—"ocr"target mode reuses the area-selector UI (screenshot-style: 1×1 min size, no recording controls, toolbar hint "Draw an area to copy text"). On mouse-up it invokes the new command instead oftakeScreenshot; on error the overlay is restored with a toast.capture_ocr_text(recording.rs) — new Tauri command:take_screenshotwas split intocapture_screen_image+save_screenshot_projectso OCR shares the capture/persistence code without duplicating it.ocr_keep_screenshot(save the region as a normal screenshot project) andocr_show_notification(system notification with a preview of the copied text).Showcase
Pressing the shortcut opens the familiar area selector, in text-capture mode:
Drag over any text and it lands on the clipboard (nothing written to disk):
The capture is a background gesture — the app you were in keeps keyboard focus afterwards:
Settings — rebindable shortcut and the two default-off toggles:
Testing (Windows, end-to-end on a live dev build)
.capscreenshot project createdKnown minor limitation: a very thin selection (~30 px tall) can return "No text was found in the selected area" (Windows.Media.Ocr small-region behavior); handled gracefully with a toast, slightly larger selections work.
macOS path uses the same Vision-based OCR code Cap already ships for the screenshot editor; it compiles for both platforms but was runtime-tested on Windows only.
Greptile Summary
Adds a global area-selection OCR workflow that captures screen pixels in memory, copies recognized text to the clipboard, and optionally saves the capture or displays a notification.
Confidence Score: 4/5
The unrelated-overlay restoration defect should be fixed before merging because invoking OCR can leave existing Cap UI windows hidden.
The new global OCR path reuses a capture helper that hides several classes of Cap windows, while its completion and recovery logic restores only target-selector overlays.
Files Needing Attention: apps/desktop/src-tauri/src/recording.rs, apps/desktop/src/routes/target-select-overlay.tsx
Important Files Changed
Comments Outside Diff (1)
apps/desktop/src-tauri/src/recording.rs, line 2878-2881 (link)When OCR runs while another Cap overlay is visible,
capture_screen_imagehides that window without restoring its visibility or cursor-event state, causing recordings, mode-selection, capture-area, or occluder overlays to remain inaccessible after the capture succeeds or fails.Knowledge Base Used:
Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "Restore macOS diagnostics types in gener..." | Re-trigger Greptile
Context used: