Skip to content

fix: open the note a Spotlight result points at on the Mac#312

Merged
fjbarrett merged 1 commit into
mainfrom
fix/mac-spotlight-open
Jul 10, 2026
Merged

fix: open the note a Spotlight result points at on the Mac#312
fjbarrett merged 1 commit into
mainfrom
fix/mac-spotlight-open

Conversation

@fjbarrett

Copy link
Copy Markdown
Owner

Summary

  • Declare NSUserActivityTypes (com.apple.corespotlightitem) in both targets' Info.plists — without it the system launches the app on a Spotlight click but never delivers the activity, so the app opened without navigating.
  • macOS never routes Spotlight activities to SwiftUI's onContinueUserActivity even when declared, so the Mac app now catches application(_:continue:restorationHandler:) in an NSApplicationDelegate and forwards the note id over NotificationCenter, the same pattern the ⌘N menu command uses.
  • Folds in the pending project.yml change that drops the App Sandbox from the dev-signed Mac build (sandboxed ad-hoc builds don't reliably surface their Core Spotlight items).

Test plan

  • xcodebuild -scheme KeepMac builds; built app's Info.plist carries NSUserActivityTypes and no sandbox entitlement
  • Launch KeepMac, search a note title in Spotlight, click the result → app opens with that note selected
  • Same from cold start (app quit) → note selected after launch

🤖 Generated with Claude Code

Spotlight results launched the app but never navigated. Two causes:
neither target declared NSUserActivityTypes, so the system never handed
the CSSearchableItemActionType activity to the SwiftUI scene; and on
macOS that scene modifier never fires for Spotlight at all, so the Mac
app now catches the activity in an app delegate and forwards the note
id over NotificationCenter (same pattern as the ⌘N command). Also folds
in the pending project.yml change dropping the App Sandbox from the
dev-signed build — sandboxed ad-hoc builds don't surface their indexed
items reliably.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@fjbarrett
fjbarrett force-pushed the fix/mac-spotlight-open branch from 93cdb0a to 6f145fe Compare July 10, 2026 01:53
@fjbarrett
fjbarrett merged commit 114a09d into main Jul 10, 2026
3 checks passed
@fjbarrett
fjbarrett deleted the fix/mac-spotlight-open branch July 10, 2026 01:55
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