Skip to content

Decode QR codes and barcodes in text capture - #2096

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

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

Conversation

@x1xhlol

@x1xhlol x1xhlol commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Extends the text-capture flow (Ctrl/Cmd+Shift+T) with QR code and barcode recognition: if the selected area contains a QR code or barcode, its decoded payload is copied to the clipboard instead of running OCR. No code found → falls back to OCR exactly as before.

  • New barcode module using rxing (Rust port of ZXing — free, on-device, supports QR plus the common 1D/2D barcode formats), decoding with TryHarder on the captured region's luma data.
  • capture_ocr_text tries the barcode decode first (on a blocking task), and only falls back to OCR when nothing is found:
    capture region in-memory → decode QR/barcode
       ├─ payload found → clipboard
       └─ none → native OCR → clipboard
    
  • No new UI or settings: same shortcut, same selector, same default-off screenshot/notification toggles.

Builds on #2095 (OCR text capture); the barcode change itself is the top commit.

Showcase

Select a QR code and its payload is on the clipboard, ready to paste:

QR payload copied to clipboard

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

Test Result
QR-only selection → clipboard = exact payload ✅
QR + surrounding caption text → payload wins over OCR ✅
Text-only selection → OCR fallback (exact text match) ✅
No click-blocking overlay left after capture ✅
Regression: normal screenshot flow unaffected ✅

macOS compiles the same path (the decoder is pure Rust, platform-independent); runtime-tested on Windows only.

RetriggerConfidence Score: 5/5

The PR appears safe to merge.

Summary

The PR extends area text capture to decode QR codes and barcodes before falling back to native OCR.

  • Adds on-device barcode decoding through rxing.
  • Introduces an OCR-area hotkey and selection flow.
  • Adds optional screenshot retention and copy notifications.
  • Refactors screenshot capture so OCR and normal screenshots share capture logic.

Reviews (2) · Last reviewed commit: "Decode QR codes and barcodes in text cap..." · Reviewed by Greptile

@socket-security

socket-security Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​rxing@​0.9.388100100100100

View full report

Comment thread apps/desktop/src-tauri/src/barcode.rs Resolved
@richiemcilroy

Copy link
Copy Markdown
Member

This builds on #2095, so it can only land after that one. Please rebase it onto #2095 (or onto main once #2095 merges), resolve the conflicts, and get Greptile to 5/5 on the latest commit with green CI before we review.

@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. Thanks. This builds on the Tauri-only text capture from #2095, which was closed, and the GPUI app doesn't have that flow. If you'd like to bring this to 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