Skip to content

feat: Auto-select provider based on active AI app#582

Open
gamithasam wants to merge 8 commits intosteipete:mainfrom
gamithasam:feature/auto-select-provider
Open

feat: Auto-select provider based on active AI app#582
gamithasam wants to merge 8 commits intosteipete:mainfrom
gamithasam:feature/auto-select-provider

Conversation

@gamithasam
Copy link

Summary:

  • Adds an optional “Show active provider” mode that switches the merged menu bar icon (and selected provider) to match the currently frontmost AI desktop app.

What changed:

  • Add ActiveAppDetector bundle-id mapping for desktop apps (Codex/Claude/Cursor/OpenCode/etc), including Electron Ollama (com.electron.ollama).
  • Add new settings:
    • menuBarShowsActiveProvider toggle (Display preferences)
    • lastActiveProvider persistence as a fallback when no relevant AI app is active
  • Update StatusItemController to observe NSWorkspace.didActivateApplicationNotification and:
    • refresh the merged icon when the active app changes
    • keep selectedMenuProvider in sync when auto-select triggers (so the menu matches the icon)
  • Add tests:
    • ActiveAppDetectorTests for exact/prefix bundle-id mapping + unknown IDs
    • SettingsStoreActiveProviderTests for defaults + persistence + invalid raw handling
    • Extend PreferencesPaneSmokeTests to include the new toggle

Tests / checks run:

  • swift test --filter ActiveAppDetectorTests
  • swift test --filter SettingsStoreActiveProviderTests
  • swift test --filter PreferencesPaneSmokeTests
  • corepack pnpm check
  • ./Scripts/compile_and_run.sh

Notes:

  • No test seam was added for NSWorkspace.frontmostApplication, so the unit tests focus on deterministic mapping + settings persistence; the notification-driven path is covered via integration behavior in-app.

gamithasam and others added 7 commits March 19, 2026 01:14
Co-Authored-By: MiniMax M2.5 <noreply@anthropic.com>
When an AI app became active, the menu bar icon updated but the underlying provider wasn't set as selected, so clicking the menu would show the previously selected provider instead.

Co-Authored-By: MiniMax M2.7 <noreply@anthropic.com>
@gamithasam gamithasam changed the title Auto-select provider based on active AI app feat: Auto-select provider based on active AI app Mar 21, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 361f481099

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…Icon

When the active-app branch is taken on app launch (no didActivateApplication notification received first), the icon updated to the active provider but selectedMenuProvider remained stale, causing the menu to resolve from the wrong provider until the next activation event.

Co-Authored-By: MiniMax M2.7 <noreply@anthropic.com>
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