Skip to content

Add Apple Shortcuts (App Intents) support#65

Open
miguelrzazo wants to merge 1 commit into
KartikLabhshetwar:mainfrom
miguelrzazo:feature/apple-shortcuts-support
Open

Add Apple Shortcuts (App Intents) support#65
miguelrzazo wants to merge 1 commit into
KartikLabhshetwar:mainfrom
miguelrzazo:feature/apple-shortcuts-support

Conversation

@miguelrzazo

Copy link
Copy Markdown

Summary

Adds macOS Shortcuts / Siri integration for BetterShot's existing capture, OCR, and recording actions, exposed via Apple's AppIntents framework:

  • Capture Region / Fullscreen / Window Screenshot — runs the same capture pipeline as the keyboard shortcuts (countdown, beautifier defaults, history, preview) and returns the saved image as a file so it can be chained into other Shortcuts steps (e.g. "Capture Region Screenshot" → "Save to Photos")
  • Scan Text from Screen — runs OCR on a user-drawn region and returns the extracted text directly to the workflow
  • Start / Stop Screen Recording — starts/stops a fullscreen recording (same pipeline + status bar as ⌘⇧2, including whatever audio settings are configured) and returns the resulting MP4 when stopped

All actions are discoverable by name in the Shortcuts app and via Siri (AppShortcutsProvider phrases like "Capture a region screenshot with BetterShot").

New code lives in Sources/Shortcuts/, mirroring the project's existing per-feature folder layout (Capture/, Editor/, Recording/, …):

  • BetterShotShortcuts.swift — the AppShortcutsProvider declaring discoverable phrases for each intent
  • ScreenshotIntents.swift — Region/Fullscreen/Window screenshot intents
  • OCRIntent.swift — text-scan intent
  • RecordingIntents.swift — start/stop recording intents
  • BetterShotIntentError.swift — user-facing errors surfaced to Shortcuts/Siri on failure

To let intents return the result of their specific capture (rather than fire-and-forget), CaptureOrchestrator.performCapture now returns a small CaptureResult enum (.image(URL) / .text(String) / .none) describing the outcome — this correctly threads through the orchestrator's existing capture queue via CheckedContinuation so a programmatic caller gets its own result even if a hotkey-triggered capture is running first. The method is @discardableResult, so the existing call sites (ShortcutService, MenuBarContentView) are unaffected.

No Info.plist or entitlement changes are needed — AppShortcutsProvider is auto-discovered by the system once the app launches.

Test plan

  • xcodegen generate && make build — confirms the new files compile (project.pbxproj entries were added by hand since this was developed without macOS/Xcode access — please regenerate via xcodegen generate to be safe)
  • make run, then open the Shortcuts app and confirm "BetterShot" exposes: Region/Fullscreen/Window Screenshot, Scan Text, Start/Stop Recording
  • Build a shortcut "Capture Region Screenshot" → "Save to Photos"/"Quick Look" and confirm the beautified PNG is returned and usable
  • Build "Scan Text" → "Show Result" and confirm OCR text comes through
  • Run "Start Screen Recording" then "Stop Screen Recording" and confirm the floating status bar behaves as with ⌘⇧2, and the returned MP4 plays
  • Try a phrase via Siri ("Hey Siri, capture a region screenshot with BetterShot")
  • Confirm existing ⌘⇧4/⌘⇧3/⌘⇧5/⌘⇧O hotkey flows and menu bar capture still work unchanged (regression check on the CaptureOrchestrator queue refactor)

🤖 Generated with Claude Code

Expose region/fullscreen/window screenshot capture, OCR text scan, and
start/stop screen recording as App Intents so they can be triggered from
the macOS Shortcuts app, Spotlight, and Siri, and chained into other
workflows via their returned image/video files or extracted text.

CaptureOrchestrator.performCapture now returns a CaptureResult (image
URL, extracted text, or none) describing the outcome of that specific
invocation — needed so intents can hand back the right artifact even
when a capture is queued behind a hotkey-triggered one. Existing callers
are unaffected since the method is @discardableResult.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the knox projects Team on Vercel.

A member of the Team first needs to authorize it.

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