Skip to content

Commit 948b972

Browse files
feat(tab-title): disable unseen_ouput alert for active tab panes (#38)
1 parent 7b69d2b commit 948b972

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

events/tab-title.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,19 @@ end
129129

130130
---@param active_pane any WezTerm https://wezfurlong.org/wezterm/config/lua/pane/index.html
131131
---@param panes any[] WezTerm https://wezfurlong.org/wezterm/config/lua/pane/index.html
132-
function Tab:set_info(active_pane, panes, max_width)
132+
---@param is_active boolean
133+
---@param max_width number
134+
function Tab:set_info(active_pane, panes, is_active, max_width)
133135
local process_name = clean_process_name(active_pane.foreground_process_name)
134136

135137
self.is_wsl = process_name:match('^wsl') ~= nil
136138
self.is_admin = (
137139
active_pane.title:match('^Administrator: ') or active_pane.title:match('(Admin)')
138140
) ~= nil
139-
self.unseen_output = check_unseen_output(panes)
141+
self.unseen_output = false
142+
if not is_active then
143+
self.unseen_output = check_unseen_output(panes)
144+
end
140145

141146
local inset = (self.is_admin or self.is_wsl) and TITLE_INSET.ICON or TITLE_INSET.DEFAULT
142147
if self.unseen_output then
@@ -250,12 +255,12 @@ M.setup = function()
250255
wezterm.on('format-tab-title', function(tab, _tabs, _panes, _config, hover, max_width)
251256
if not tab_list[tab.tab_id] then
252257
tab_list[tab.tab_id] = Tab:new()
253-
tab_list[tab.tab_id]:set_info(tab.active_pane, tab.panes, max_width)
258+
tab_list[tab.tab_id]:set_info(tab.active_pane, tab.panes, tab.is_active, max_width)
254259
tab_list[tab.tab_id]:create_cells()
255260
return tab_list[tab.tab_id]:render()
256261
end
257262

258-
tab_list[tab.tab_id]:set_info(tab.active_pane, tab.panes, max_width)
263+
tab_list[tab.tab_id]:set_info(tab.active_pane, tab.panes, tab.is_active, max_width)
259264
tab_list[tab.tab_id]:update_cells(tab.is_active, hover)
260265
return tab_list[tab.tab_id]:render()
261266
end)

0 commit comments

Comments
 (0)