Add Apple Shortcuts (App Intents) support#65
Open
miguelrzazo wants to merge 1 commit into
Open
Conversation
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>
|
Someone is attempting to deploy a commit to the knox projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds macOS Shortcuts / Siri integration for BetterShot's existing capture, OCR, and recording actions, exposed via Apple's
AppIntentsframework:⌘⇧2, including whatever audio settings are configured) and returns the resulting MP4 when stoppedAll actions are discoverable by name in the Shortcuts app and via Siri (
AppShortcutsProviderphrases 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— theAppShortcutsProviderdeclaring discoverable phrases for each intentScreenshotIntents.swift— Region/Fullscreen/Window screenshot intentsOCRIntent.swift— text-scan intentRecordingIntents.swift— start/stop recording intentsBetterShotIntentError.swift— user-facing errors surfaced to Shortcuts/Siri on failureTo let intents return the result of their specific capture (rather than fire-and-forget),
CaptureOrchestrator.performCapturenow returns a smallCaptureResultenum (.image(URL)/.text(String)/.none) describing the outcome — this correctly threads through the orchestrator's existing capture queue viaCheckedContinuationso 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.plistor entitlement changes are needed —AppShortcutsProvideris 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 viaxcodegen generateto be safe)make run, then open the Shortcuts app and confirm "BetterShot" exposes: Region/Fullscreen/Window Screenshot, Scan Text, Start/Stop Recording⌘⇧2, and the returned MP4 plays⌘⇧4/⌘⇧3/⌘⇧5/⌘⇧Ohotkey flows and menu bar capture still work unchanged (regression check on theCaptureOrchestratorqueue refactor)🤖 Generated with Claude Code