Skip to content

Commit 596e4cd

Browse files
committed
get notifications working on macos
1 parent 1609e0e commit 596e4cd

1 file changed

Lines changed: 30 additions & 20 deletions

File tree

plugin/init.lua

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -662,28 +662,38 @@ local function notify_waiting(pane, agent_type, config)
662662
return
663663
end
664664

665-
local window = nil
666-
pcall(function()
667-
local tab = pane:tab()
668-
if tab then window = tab:window() end
669-
end)
665+
local titles = {
666+
opencode = 'OpenCode',
667+
claude = 'Claude',
668+
gemini = 'Gemini',
669+
codex = 'Codex',
670+
aider = 'Aider',
671+
}
672+
local title = (titles[agent_type] or agent_type) .. ' - Attention Needed'
673+
local message = 'Needs your input'
674+
local timeout_ms = config.notifications.timeout_ms or 4000
675+
676+
-- Navigate from pane to GuiWindow: pane -> tab -> mux_window -> gui_window
677+
local tab = pane:tab()
678+
if not tab then
679+
wezterm.log_warn('[agent-deck] notification failed: pane has no tab')
680+
return
681+
end
670682

671-
if window then
672-
local titles = {
673-
opencode = 'OpenCode',
674-
claude = 'Claude',
675-
gemini = 'Gemini',
676-
codex = 'Codex',
677-
aider = 'Aider',
678-
}
679-
local title = (titles[agent_type] or agent_type) .. ' - Attention Needed'
680-
local message = 'Needs your input'
681-
local timeout = config.notifications.timeout_ms or 4000
682-
683-
pcall(function()
684-
window:toast_notification(title, message, nil, timeout)
685-
end)
683+
local mux_window = tab:window()
684+
if not mux_window then
685+
wezterm.log_warn('[agent-deck] notification failed: tab has no window')
686+
return
687+
end
688+
689+
local gui_window = mux_window:gui_window()
690+
if not gui_window then
691+
wezterm.log_warn('[agent-deck] notification failed: mux_window has no gui_window (headless?)')
692+
return
686693
end
694+
695+
gui_window:toast_notification(title, message, nil, timeout_ms)
696+
wezterm.log_info('[agent-deck] notification sent: ' .. title)
687697
end
688698

689699
--[[ ============================================

0 commit comments

Comments
 (0)