Skip to content

Commit

Permalink
fix: renamed tab not sized uniformly + background image changing when…
Browse files Browse the repository at this point in the history
… toggling tab-bar
  • Loading branch information
KevinSilvester committed Oct 30, 2024
1 parent 8b04f80 commit bd8119b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions events/tab-title.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ end
---@field title string
---@field cells Cells
---@field title_locked boolean
---@field locked_title string
---@field is_wsl boolean
---@field is_admin boolean
---@field unseen_output boolean
Expand All @@ -105,6 +106,7 @@ function Tab:new()
title = '',
cells = Cells:new(),
title_locked = false,
locked_title = '',
is_wsl = false,
is_admin = false,
unseen_output = false,
Expand All @@ -119,13 +121,15 @@ function Tab:set_info(pane, max_width)
self.is_admin = (pane.title:match('^Administrator: ') or pane.title:match('(Admin)')) ~= nil
self.unseen_output = pane.has_unseen_output

if self.title_locked then
return
end
local inset = (self.is_admin or self.is_wsl) and TITLE_INSET.ICON or TITLE_INSET.DEFAULT
if self.unseen_output then
inset = inset + 2
end

if self.title_locked then
self.title = create_title('', self.locked_title, max_width, inset)
return
end
self.title = create_title(process_name, pane.title, max_width, inset)
end

Expand All @@ -142,7 +146,7 @@ end

---@param title string
function Tab:update_and_lock_title(title)
self.title = title
self.locked_title = title
self.title_locked = true
end

Expand Down Expand Up @@ -221,7 +225,11 @@ M.setup = function()
-- Event listener to manually update the tab name
wezterm.on('tabs.toggle-tab-bar', function(window, _pane)
enable_tab_bar = not enable_tab_bar
window:set_config_overrides({ enable_tab_bar = enable_tab_bar })
local background = window:effective_config().background
window:set_config_overrides({
enable_tab_bar = enable_tab_bar,
background = background,
})
end)

-- BUILTIN EVENT
Expand Down

0 comments on commit bd8119b

Please sign in to comment.