Bug
suppressWhenFocused: true (the default) has no effect when using WezTerm on macOS. Notifications fire even when the WezTerm window is the active/focused window.
Root cause
On macOS, focus detection works by calling:
osascript -e 'tell application "System Events" to return name of first application process whose frontmost is true'
System Events reports the CFBundleExecutable value from the app's Info.plist as the process name. For WezTerm, that value is wezterm-gui.
The plugin's MAC_TERMINAL_APP_NAMES set includes "wezterm", and when TERM_PROGRAM=WezTerm, getExpectedMacTerminalAppNames adds "wezterm" to the expected set. But "wezterm-gui" !== "wezterm", so isMacTerminalAppFocused always returns false.
This can be verified:
osascript -e 'tell application "System Events" to return name of first application process whose frontmost is true'
# => wezterm-gui
Scope
Affects all macOS WezTerm users regardless of install method. The CFBundleExecutable is wezterm-gui in the official .app bundle itself (confirmed in the Homebrew cask and WezTerm's own Info.plist). This is not installation-specific.
Fix
In src/focus.ts, change the expected process name for WezTerm from "wezterm" to "wezterm-gui":
- } else if (termProgram === "warpterminal") {
- expected.add("warp");
- } else if (termProgram.length > 0) {
+ } else if (termProgram === "warpterminal") {
+ expected.add("warp");
+ } else if (termProgram === "wezterm") {
+ expected.add("wezterm-gui");
+ } else if (termProgram.length > 0) {
Or alternatively add "wezterm-gui" to MAC_TERMINAL_APP_NAMES.
Environment
- macOS (Homebrew cask install, but affects all installs)
- WezTerm 20240203-110809-5046fc22
TERM_PROGRAM=WezTerm
- Frontmost app name from System Events:
wezterm-gui
Bug
suppressWhenFocused: true(the default) has no effect when using WezTerm on macOS. Notifications fire even when the WezTerm window is the active/focused window.Root cause
On macOS, focus detection works by calling:
System Eventsreports theCFBundleExecutablevalue from the app'sInfo.plistas the process name. For WezTerm, that value iswezterm-gui.The plugin's
MAC_TERMINAL_APP_NAMESset includes"wezterm", and whenTERM_PROGRAM=WezTerm,getExpectedMacTerminalAppNamesadds"wezterm"to the expected set. But"wezterm-gui" !== "wezterm", soisMacTerminalAppFocusedalways returnsfalse.This can be verified:
Scope
Affects all macOS WezTerm users regardless of install method. The
CFBundleExecutableiswezterm-guiin the official.appbundle itself (confirmed in the Homebrew cask and WezTerm's ownInfo.plist). This is not installation-specific.Fix
In
src/focus.ts, change the expected process name for WezTerm from"wezterm"to"wezterm-gui":Or alternatively add
"wezterm-gui"toMAC_TERMINAL_APP_NAMES.Environment
TERM_PROGRAM=WezTermwezterm-gui