feat(desktop): screen text capture (OCR) overlay with selectable text

A rebindable screen-ocr action (default Ctrl+Alt+O) freezes the monitor under the cursor and
covers it with a focusable overlay. Text is selected by flow drag, rectangle drag, double/triple
click, Shift+click or Ctrl+A, then copied, saved as PNG or searchable PDF, translated,
summarized, read aloud, opened as a link or searched.

- Selection, text assembly and the PDF document are pure functions in @d3ro/core/screen-ocr,
  shared by the main process and the overlay.
- Recognition uses Windows.Media.Ocr through powershell.exe -EncodedCommand with 2x upscaling;
  the capture reaches disk only as a temp PNG that is removed right after recognition.
- Capture uses GDI BitBlt for the target monitor (39 ms) because desktopCapturer captured all
  three monitors and took 2.9 s when DXGI duplication timed out.
- The accelerator is reserved only where the feature is available, so macOS does not swallow
  the key for a feature it cannot run (fails closed with a message).

Map: CAP-17 [~], GAP-OCR-01 (live hotkey journey not yet driven in the running app),
GAP-OCR-02 (macOS engine, mixed-language accuracy).
This commit is contained in:
Yun Chan 2026-11-20 15:16:37 +09:00
parent 6791e29f27
commit 03cd8bf890
41 changed files with 4561 additions and 17 deletions

View file

@ -31,6 +31,16 @@ export interface PopupWindowSpec {
* 항상 보이는 창(자막 오버레이)만 true 로 둔다.
*/
backgroundThrottling?: boolean
/**
* 키보드 포커스를 받을지. 기본 false — 팝업은 쓰던 앱의 포커스를 빼앗지 않는다.
* 화면 OCR 오버레이만 true 다(화면을 덮고 Esc · Ctrl+C 를 직접 받는다).
*/
focusable?: boolean
/**
* 투명 창인지. 기본 true. 화면 전체를 그림으로 덮는 창은 false 로 둔다 —
* 투명 창은 첫 그리기 전에 뒤 화면이 비쳐 깜빡인다.
*/
transparent?: boolean
/** 로드 전에 적용할 창 설정 (클릭 통과 등) */
beforeLoad?: (win: BrowserWindow) => void
/** 창이 닫혔다 — 소유자가 참조를 지운다 */
@ -46,11 +56,11 @@ export function buildPopupWindowOptions(
...spec.bounds,
show: false,
frame: false,
transparent: true,
transparent: spec.transparent ?? true,
resizable: false,
alwaysOnTop: true,
skipTaskbar: true,
focusable: false,
focusable: spec.focusable ?? false,
webPreferences: {
preload: preloadPath,
sandbox: false,