Skip to content

fix(app-detection): match macOS nested app identities#196

Open
chenqianhe wants to merge 6 commits into
TomBadash:masterfrom
chenqianhe:fix-macos-app-window-mapping
Open

fix(app-detection): match macOS nested app identities#196
chenqianhe wants to merge 6 commits into
TomBadash:masterfrom
chenqianhe:fix-macos-app-window-mapping

Conversation

@chenqianhe

@chenqianhe chenqianhe commented Jun 1, 2026

Copy link
Copy Markdown

Fix macOS per-app profile matching for apps that launch nested or helper app bundles.

Previously, Mouser matched the foreground macOS app using a single identifier. Some apps launch secondary .app bundles from inside the main application bundle, which caused profile matching to miss the configured host app profile. This PR changes foreground app detection to return an ordered tuple of app identities, from the most specific nested app to broader host app identities, so profile lookup can first match a nested app profile and then fall back to the host app profile.

Changes

  • Return ordered foreground app identities from macOS app detection.
  • Include bundle identifiers, bundle paths, bundle names, executable paths, and localized names as matching candidates.
  • Update profile lookup to match ordered identities and cache alias resolution per lookup.
  • Remove legacy single-string foreground/profile matching APIs.
  • Tighten typing around app identity handling.
  • Improve app detector tests so platform-specific imports do not leak between tests.
  • Add coverage for nested macOS app identity matching and fallback behavior.

@chenqianhe chenqianhe changed the title Fix macos app window mapping fix(engine): macos app window mapping Jun 1, 2026
@chenqianhe chenqianhe changed the title fix(engine): macos app window mapping fix(app-detection): match macOS nested app identities Jun 1, 2026
@chenqianhe chenqianhe marked this pull request as ready for review June 1, 2026 12:23
@farfromrefug

Copy link
Copy Markdown
Collaborator

@chenqianhe can you provide an example app we can test with?

@chenqianhe

Copy link
Copy Markdown
Author

@chenqianhe can you provide an example app we can test with?

I originally ran into this with a game platform app, but that may not be a convenient test case for everyone. I asked AI to help find some more common examples of real nested macOS apps that should be easier to test, such as Xcode Simulator or Instruments.

The key case is a focusable app whose .app bundle lives inside another .app bundle, not just an Electron helper process.

Examples:

  • Xcode Simulator:
    /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
    bundle id: com.apple.iphonesimulator

  • Xcode Instruments:
    /Applications/Xcode.app/Contents/Applications/Instruments.app
    bundle id: com.apple.dt.Instruments

  • Parallels VM:
    /Applications/Parallels Desktop.app/Contents/MacOS/Parallels VM.app
    bundle id: com.parallels.vm

These are normal focusable apps/windows, but their bundle path is nested under another outer .app. The behavior to test is: when the foreground app resolves to the nested bundle, Mouser should include both the inner app identity and the outer containing .app identity, so a specific nested profile can win while an outer-app profile can still work as fallback.

@farfromrefug

Copy link
Copy Markdown
Collaborator

@chenqianhe thanks will try with ios simulator

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