Skip to content

fix(lock): detect Spotlight hosted by Siri AI on macOS 27 - #64

Merged
BlackHole1 merged 1 commit into
mainfrom
fix/spotlight-macos27-siri-host
Aug 28, 2026
Merged

fix(lock): detect Spotlight hosted by Siri AI on macOS 27#64
BlackHole1 merged 1 commit into
mainfrom
fix/spotlight-macos27-siri-host

Conversation

@BlackHole1

Copy link
Copy Markdown
Member

On macOS 27 the Cmd-Space panel is drawn by the Siri AI process (com.apple.campo, shown as "Siri") and the Spotlight process never runs, so FloatingAppMonitor had nothing to observe and a Spotlight rule silently did nothing, whether Lock to or Switch to. The rule identity stays com.apple.Spotlight: the monitor now also observes the host, and LauncherOverlayCatalog.ruleIdentity maps a focused host that is not the frontmost app to Spotlight, while a frontmost host (Siri's regular chat window) keeps its own identity so a Siri rule can coexist.

Two more AX notifications drive the re-read: AXWindowResized, because the dismissed panel is only destroyed after its fade-out, about 0.7 s after focus has already returned to the app behind it, and AXApplicationDeactivated, so the chat window losing focus clears the attribution instead of the next panel being de-duplicated away. A same-value launcher report is now a no-op in LockEngine, since such a late re-read used to reset the address-bar focus, and the picker offers Spotlight even when it is not running ( /System/Library/CoreServices is never scanned).

On macOS 26 and earlier nothing changes beyond the extra de-duplicated focus reads: Spotlight keeps running, every non-host launcher resolves as itself, and the catalog host has no process. Verified on macOS 27.0 (26A5421a) with the real app: Cmd-Space switches to the rule's source in about 170 ms and the log attributes it to com.apple.Spotlight with reason launcherFocused, Escape reverts in about 70 ms, and the Siri chat window never hits the Spotlight rule. New engine, catalog and scanner tests cover the mapping, the guard and the picker entry.

Closes #63

On macOS 27 the Cmd-Space panel is drawn by the Siri AI process (`com.apple.campo`) and the `Spotlight` process never runs, so `FloatingAppMonitor` had no launcher process to observe and a Spotlight rule silently did nothing, whether Lock to or Switch to.

Observe that host as well, and let `LauncherOverlayCatalog.ruleIdentity` map a focused host that is not the frontmost app to `com.apple.Spotlight`, so existing rules, backups and the picker entry keep working, while a frontmost host (Siri's regular chat window) keeps its own identity and can carry a rule of its own.

The watched notifications gain `AXWindowResized` and `AXApplicationDeactivated`: the dismissed panel is only destroyed after its fade-out, about 0.7 s after focus has already returned to the app behind it, and the host's chat window deactivating must clear the stale attribution or the next panel over another app would be de-duplicated away. Such a re-read can also land after the frontmost change already cleared the attribution, so a same-value launcher report is now a no-op in `LockEngine` instead of resetting the address-bar focus. Finally, the app picker offers Spotlight even when its process is not running, since _/System/Library/CoreServices_ is never scanned and the running-apps pass was the only way it ever got listed.

Closes #63

Signed-off-by: Kevin Cui <bh@bugs.cc>
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ababa29b-c64e-4c5a-a9f8-6c35baea1119

📥 Commits

Reviewing files that changed from the base of the PR and between eda1894 and eb868ef.

📒 Files selected for processing (9)
  • Sources/LockIMEKit/AppMonitor/FloatingAppMonitor.swift
  • Sources/LockIMEKit/AppMonitor/InstalledAppsScanner.swift
  • Sources/LockIMEKit/AppMonitor/LauncherOverlayCatalog.swift
  • Sources/LockIMEKit/LockEngine/LockEngine.swift
  • Tests/LockIMEKitTests/InstalledAppsScannerTests.swift
  • Tests/LockIMEKitTests/LauncherOverlayCatalogTests.swift
  • Tests/LockIMEKitTests/LockEngineAddressBarTests.swift
  • Tests/LockIMEKitTests/LockEngineTests.swift
  • docs/DESIGN.md

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Summary by CodeRabbit

  • New Features
    • Improved Spotlight and Siri panel detection on macOS 27.
    • App picker now includes installed launcher overlays, even when they are not running.
  • Bug Fixes
    • Prevented stale focus updates from clearing an active address bar or changing its input source.
    • Reduced redundant focus reevaluation during launcher transitions.
    • Improved lock-rule handling when Spotlight or Siri panels open and close.
  • Documentation
    • Updated design documentation for macOS 27 Spotlight and Siri behavior.

Walkthrough

The launcher catalog now recognizes Spotlight and the macOS 27 Siri AI host, mapping non-frontmost Siri-hosted panels to Spotlight rules while preserving Siri identity for frontmost Siri windows. Installed launcher overlays appear in the app picker even when they are not running. Focus monitoring now re-evaluates after window resize and application deactivation. LockEngine avoids duplicate launcher transitions. Tests cover discovery, rule resolution, focus retention, and hosted Spotlight behavior. Documentation records the updated design.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant FloatingAppMonitor
  participant LockEngine
  participant LauncherOverlayCatalog
  User->>FloatingAppMonitor: Open Spotlight panel
  FloatingAppMonitor->>LockEngine: Report Siri AI host focus
  LockEngine->>LauncherOverlayCatalog: Resolve launcher rule identity
  LauncherOverlayCatalog-->>LockEngine: Return Spotlight identity
  LockEngine-->>User: Apply Spotlight rule
  FloatingAppMonitor->>LockEngine: Report resize or deactivation
  LockEngine-->>User: Re-evaluate focused element
Loading

Merge Risk: ⚪ Minimal · up to eb868

This change adds macOS 27 Siri-hosted Spotlight detection while preserving existing Siri behavior and adds focused coverage for the new mapping and safeguards. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required format fix(lock): <subject>, uses English, and accurately describes the Spotlight detection fix for macOS 27.
Description check ✅ Passed The description directly explains the macOS 27 Siri host behavior, the implementation changes, test coverage, and resolution of issue #63.
Linked Issues check ✅ Passed The changes address issue #63 by detecting Spotlight when hosted by com.apple.campo, preserving correct rule identity, supporting both Switch to and Lock to behavior, and adding regression coverage.
Out of Scope Changes check ✅ Passed All implementation, test, and documentation changes support Spotlight detection and rule handling described in issue #63. No unrelated changes are evident.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/spotlight-macos27-siri-host

Comment @coderabbitai help to get the list of available commands.

@BlackHole1
BlackHole1 merged commit edb417c into main Aug 28, 2026
4 checks passed
@BlackHole1
BlackHole1 deleted the fix/spotlight-macos27-siri-host branch August 28, 2026 09:58
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.

聚焦(Spotlight)无法生效

1 participant