Skip to content

Commit

Permalink
feat(wezterm): add arrows and indicies
Browse files Browse the repository at this point in the history
  • Loading branch information
miszo committed Oct 12, 2024
1 parent e8b2359 commit 3461fe5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
8 changes: 8 additions & 0 deletions home/dot_config/exact_wezterm/exact_config/keys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ function M.setup(config)
{ mods = 'CMD', key = 'RightArrow', action = act.SendString('\x1bOF') },
{ mods = 'CMD', key = 'Backspace', action = act.SendString('\x15') },
}

for i = 1, 9 do
table.insert(config.keys, {
key = tostring(i),
mods = 'LEADER',
action = act.ActivateTab(i - 1),
})
end
end

return M
16 changes: 9 additions & 7 deletions home/dot_config/exact_wezterm/exact_config/tabs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ function M.title(tab, max_width)
title = wezterm.nerdfonts.fa_bars .. ' ' .. title
end

title = wezterm.truncate_right(title, max_width - 3)
return ' ' .. title .. ' '
title = wezterm.truncate_right(title, max_width - 8)
return ' ' .. tab.tab_index + 1 .. ': ' .. title .. ' '
end

---@param config Config
Expand All @@ -158,9 +158,7 @@ function M.setup(config)
end
end
local is_last = tab_idx == #tabs
local next_tab = tabs[tab_idx + 1]
local next_is_active = next_tab and next_tab.is_active
local arrow = (tab.is_active or is_last or next_is_active) and M.right_arrow_thick or M.right_arrow_thin
local arrow = (tab.is_active or is_last) and M.right_arrow_thick or M.right_arrow_thin
local arrow_bg = inactive_bg
local arrow_fg = colors.tab_bar.inactive_tab_edge

Expand All @@ -170,9 +168,9 @@ function M.setup(config)
elseif tab.is_active then
arrow_bg = inactive_bg
arrow_fg = active_bg
elseif next_is_active then
arrow_bg = active_bg
else
arrow_fg = inactive_bg
arrow_bg = inactive_bg
end

local ret = tab.is_active
Expand All @@ -181,6 +179,10 @@ function M.setup(config)
{ Attribute = { Italic = true } },
}
or {}
ret[#ret + 1] = { Foreground = { Color = arrow_fg } }
ret[#ret + 1] = { Background = { Color = arrow_bg } }
ret[#ret + 1] = { Text = M.left_arrow_tick }
ret[#ret + 1] = 'ResetAttributes'
ret[#ret + 1] = { Text = title }
ret[#ret + 1] = { Foreground = { Color = arrow_fg } }
ret[#ret + 1] = { Background = { Color = arrow_bg } }
Expand Down

0 comments on commit 3461fe5

Please sign in to comment.