Skip to content

feat: global OCR text capture in the GPUI app (Ctrl/Cmd+Shift+T) - #3238

Open
x1xhlol wants to merge 1 commit into
CapSoftware:mainfrom
x1xhlol:devin/gpui-ocr-text-capture
Open

x1xhlol wants to merge 1 commit into
CapSoftware:mainfrom
x1xhlol:devin/gpui-ocr-text-capture

Conversation

@x1xhlol

@x1xhlol x1xhlol commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

GPUI port of #2095. A new global hotkey opens the area picker in OCR mode; releasing a drawn area recognizes the text in it and copies it to the clipboard.

  • HotkeyAction::OcrArea (ocrArea), seeded once to Cmd+Shift+T (macOS) / Ctrl+Shift+T. Seeding uses the same hotkeys.seeded array the Tauri app writes, so it never re-adds a binding the user cleared and skips the combo if another action already owns it.
  • app_windows::arm_ocr_area sets TargetSelect::ocr_area without changing the user's recording mode. Every other arming path clears it. While it is set, the area overlay uses screenshot sizing and chrome (is_screenshot_like()), and a fresh draw calls ocr::capture_text instead of take_screenshot.
  • ocr::capture_text: capture, then OCR via Vision (cidre, macOS) or Windows.Media.Ocr. OCR is macOS/Windows only: on Linux the hotkey is not seeded or registered and the OCR settings and shortcut row are hidden. The trimmed text goes to the clipboard and plays the notification sound. A failed optional screenshot save is reported separately and does not drop the copied text; error notifications respect enableNotifications. If the picker is owned by the editor, that picker is cancelled through its normal path before OCR arms. The main window comes back without focus only if the picker hid it (ocr_finished).
  • General settings get a "Text capture (OCR)" section with ocrKeepScreenshot (save the region as a normal screenshot bundle through the new screenshot::write_screenshot_bundle, without opening the editor) and ocrShowNotification (posts through notify-rust on macOS/Windows).
  • The Shortcuts page lists "Copy text from an area". Settings and notification strings are translated in every shipped locale.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with no new blocking issue established.

Summary

Adds area-based OCR through a global shortcut on macOS and Windows.

  • A new shortcut turns a drawn screen area into copied text.
  • OCR settings control screenshot saving and copy notifications.
  • A settings expression and module declaration move without changing behavior.

No new findings were accepted. Native builds and visual checks were not run.

Reviews (3) · Last reviewed commit: "Add global OCR text capture to the GPUI ..." · 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/app_windows.rs Resolved
Comment thread apps/desktop-gpui/src/hotkeys.rs Resolved
Comment thread apps/desktop-gpui/src/ocr.rs Resolved
Comment thread apps/desktop-gpui/src/ocr.rs Resolved
Comment thread apps/desktop-gpui/src/target_overlay.rs Resolved
Comment thread apps/desktop-gpui/src/ocr.rs Resolved
@richiemcilroy

Copy link
Copy Markdown
Member

Thanks for porting this to the GPUI app, @x1xhlol!

Before we can merge, the PR needs a 5/5 from Greptile on its latest commit and green CI. It's at 3/5 right now. The two P1s need fixing first:

  • The editor stays hidden after an OCR capture started while an editor-owned picker was open. Restore the editor and clear its pending recording state, or close the editor-owned picker before arming OCR.
  • On Linux the shortcut is seeded and shown, but every capture fails without telling the user anything. Please only seed and show the shortcut and the OCR settings on macOS and Windows.

The P2s are worth fixing in the same pass: notifications showing when they're turned off, the image save blocking the text copy, the capture button going missing on an existing crop, and English-only notification text. Once those are in, request a re-review. #3239 and #3240 are stacked on this one, so it makes sense to land this first.

@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-ocr-text-capture branch from 1fd7e44 to 94ddce2 Compare October 25, 2026 12:43
@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-ocr-text-capture branch from 94ddce2 to 5ce07ee Compare October 25, 2026 14:23
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/gpui-ocr-text-capture branch from 5ce07ee to 939044e Compare October 25, 2026 14:51
@richiemcilroy

Copy link
Copy Markdown
Member

Thanks! Can you get Greptile to 5/5 on the latest commit and 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