Skip to content

fix: detect iTerm2 hotkey window as focused on macOS#76

Merged
mohak34 merged 1 commit into
mohak34:mainfrom
mmatviyiv:fix/iterm2-hotkey-focus-detection
May 14, 2026
Merged

fix: detect iTerm2 hotkey window as focused on macOS#76
mohak34 merged 1 commit into
mohak34:mainfrom
mmatviyiv:fix/iterm2-hotkey-focus-detection

Conversation

@mmatviyiv

Copy link
Copy Markdown
Contributor

Summary

Fixes suppressWhenFocused not working with iTerm2 hotkey popup windows on macOS.

Problem

When iTerm2 is configured with "Exclude from Dock and Cmd-Tab Application Switcher" (hotkey popup window mode), System Events AppleScript fails to detect iTerm2 as the frontmost application. This causes the plugin to show notifications even when the user is actively interacting with iTerm2.

Solution

Use lsappinfo (built-in macOS CLI) instead of System Events AppleScript for frontmost app detection. lsappinfo correctly reports iTerm2 as frontmost in this mode.

Changes

  • src/focus.ts: getMacOSFrontmostAppName() now uses lsappinfo as primary method with System Events as fallback

Use lsappinfo instead of System Events AppleScript for frontmost app
detection. System Events fails to detect iTerm2 as frontmost when it
is configured with "Exclude from Dock and Cmd-Tab Application
Switcher" (hotkey popup window mode). lsappinfo correctly reports
iTerm2 as the frontmost app in this case.
@mmatviyiv mmatviyiv force-pushed the fix/iterm2-hotkey-focus-detection branch from 652bf0b to 127f8f3 Compare May 11, 2026 16:21
@mohak34 mohak34 merged commit 5170cc2 into mohak34:main May 14, 2026
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