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