refactor(wezterm): comments/cleanup
This commit is contained in:
parent
2e8bdd0036
commit
20216389da
1 changed files with 49 additions and 32 deletions
|
@ -61,8 +61,10 @@ local function get_font(name)
|
|||
end
|
||||
-- }}}
|
||||
|
||||
local function superscript(number)
|
||||
local numbers = {
|
||||
-- superscript/subscript {{{
|
||||
local function numberStyle(number, script)
|
||||
local scripts = {
|
||||
superscript = {
|
||||
"⁰",
|
||||
"¹",
|
||||
"²",
|
||||
|
@ -73,20 +75,35 @@ local function superscript(number)
|
|||
"⁷",
|
||||
"⁸",
|
||||
"⁹",
|
||||
},
|
||||
subscript = {
|
||||
"₀",
|
||||
"₁",
|
||||
"₂",
|
||||
"₃",
|
||||
"₄",
|
||||
"₅",
|
||||
"₆",
|
||||
"₇",
|
||||
"₈",
|
||||
"₉",
|
||||
},
|
||||
}
|
||||
local numbers = scripts[script]
|
||||
local number_string = tostring(number)
|
||||
local result = ""
|
||||
for i = 1, #number_string do
|
||||
local char = number_string:sub(i, i)
|
||||
local number = tonumber(char)
|
||||
if number then
|
||||
result = result .. numbers[number + 1]
|
||||
local num = tonumber(char)
|
||||
if num then
|
||||
result = result .. numbers[num + 1]
|
||||
else
|
||||
result = result .. char
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- custom tab bar {{{
|
||||
-- @diagnostic disable-next-line: unused-local
|
||||
|
@ -145,7 +162,7 @@ wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_wid
|
|||
return {
|
||||
{ Background = { Color = s_bg } },
|
||||
{ Foreground = { Color = s_fg } },
|
||||
{ Text = " " .. tab.tab_index + 1 .. ": " .. tab.active_pane.title .. superscript(count) .. " " },
|
||||
{ Text = " " .. tab.tab_index + 1 .. ": " .. tab.active_pane.title .. numberStyle(count, "superscript") .. " " },
|
||||
{ Background = { Color = e_bg } },
|
||||
{ Foreground = { Color = e_fg } },
|
||||
{ Text = RIGHT_DIVIDER },
|
||||
|
@ -153,7 +170,6 @@ wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_wid
|
|||
end)
|
||||
-- }}}
|
||||
|
||||
|
||||
local function get_os()
|
||||
local target = wezterm.target_triple
|
||||
if string.find(target, "linux") then
|
||||
|
@ -163,6 +179,8 @@ local function get_os()
|
|||
end
|
||||
end
|
||||
|
||||
-- different padding on macOS and Linux
|
||||
-- this is because the macOS window borders are "on the inside" of the window
|
||||
local window_padding = {
|
||||
linux = {
|
||||
left = 0,
|
||||
|
@ -179,11 +197,10 @@ local window_padding = {
|
|||
}
|
||||
|
||||
local function scheme_for_appearance(appearance)
|
||||
-- default to dark mode, so I don't burn out my eyes
|
||||
if not appearance:find("Dark") then
|
||||
return "Catppuccin Latte"
|
||||
else
|
||||
if appearance:find("Dark") then
|
||||
return "Catppuccin Frappe"
|
||||
else
|
||||
return "Catppuccin Latte"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -254,5 +271,5 @@ return {
|
|||
-- nightly only
|
||||
clean_exit_codes = { 130 },
|
||||
-- bell
|
||||
audible_bell = "Disabled"
|
||||
audible_bell = "Disabled",
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue