Skip to content

feat(desktop): grid nativo e recorte magnetico de captura - #12

Merged
RenanMev merged 1 commit into
mainfrom
feature/capture-magnetism
Aug 12, 2026
Merged

feat(desktop): grid nativo e recorte magnetico de captura#12
RenanMev merged 1 commit into
mainfrom
feature/capture-magnetism

Conversation

@RenanMev

@RenanMev RenanMev commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adiciona captura nativa com xcap: grid de janelas/monitores com thumbnail, titulo real e exclusao das janelas do proprio Linvo
  • Overlay fullscreen com tela congelada e magnetismo via UI Automation (ElementFromPoint), com recorte livre por arraste e fallback getDisplayMedia
  • Liga o menu do composer em tres caminhos: escolher fonte, recorte magnetico e seletor do sistema

Test plan

  • cargo check no src-tauri
  • tsc --noEmit no desktop
  • Vitest focado: 31 testes (menu, hook, close do overlay, helpers)
  • Manual: abrir grid, capturar janela, confirmar no preview
  • Manual: Recorte magnetico — hover destaca elemento, Enter confirma, Esc cancela
  • Manual: fallback "Seletor do sistema" ainda funciona

Relacionado


Note

Medium Risk
Screen-capture and overlay behavior are platform-sensitive (permissions, multi-monitor sizing, large base64 payloads), and magnetic snapping depends on Windows COM/UIA with non-Windows degradation; xcap adds a sizable native dependency surface.

Overview
Native visual context capture replaces the composer’s direct “capture window / full screen” actions with three paths: a thumbnail grid of windows and monitors (via xcap), magnetic crop on a frozen multi-monitor snapshot, and the existing getDisplayMedia system picker.

The Tauri side adds a capture module with commands to list sources (with thumbnails, titles, and Linvo self-window exclusion), capture PNG bytes/metadata, open/close a dedicated capture-overlay webview spanning the virtual desktop, and on Windows resolve element bounds under the cursor via UI Automation (ElementFromPoint) with HWND fallback. Capabilities and capture.toml permissions wire these invokes; Cargo.toml pulls in xcap, image, base64, and Windows accessibility crates.

The React layer adds CaptureSourcePicker, CaptureOverlayApp (drag selection, debounced magnet highlight, Enter/Esc), and extends useDisplaySnapshot with picker state, native source capture into the existing preview/crop draft flow, and overlay result/cancel listeners. ChatInput menu and tests are updated accordingly; window chrome treats capture-overlay close as hiding the overlay.

Reviewed by Cursor Bugbot for commit 77f9287. Configure here.

Substitui a dependencia exclusiva do picker do WebView2 por enumeracao
nativa (xcap) e overlay com UI Automation, mantendo getDisplayMedia como
fallback para testes e ambientes sem invoke.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_94f189f6-94ed-443c-af02-e2842e3cffdd)

@RenanMev
RenanMev merged commit 6c03885 into main Aug 12, 2026
3 checks passed
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.

1 participant