mirror of
https://github.com/blahai/nyx.git
synced 2025-06-08 16:13:02 -04:00
add wezterm config (borrowed from isabel)
This commit is contained in:
parent
c85a317bc8
commit
26de676486
9 changed files with 1112 additions and 80 deletions
|
@ -5,5 +5,6 @@
|
|||
./fish/default.nix
|
||||
./alacritty/default.nix
|
||||
./foot/default.nix
|
||||
./wezterm/default.nix
|
||||
];
|
||||
}
|
||||
|
|
360
modules/home-manager/cli/wezterm/bar.lua
Normal file
360
modules/home-manager/cli/wezterm/bar.lua
Normal file
|
@ -0,0 +1,360 @@
|
|||
-- https://github.com/nekowinston/wezterm-bar
|
||||
local wezterm = require("wezterm")
|
||||
|
||||
local M = {}
|
||||
|
||||
-- default configuration
|
||||
local config = {
|
||||
position = "top", -- or "bottom"
|
||||
max_width = 32,
|
||||
dividers = "slant_right", -- "slant_right" or "slant_left", "arrows", "rounded", false
|
||||
indicator = {
|
||||
leader = {
|
||||
enabled = true,
|
||||
off = " ",
|
||||
on = " ",
|
||||
},
|
||||
mode = {
|
||||
enabled = true,
|
||||
names = {
|
||||
resize_mode = "RESIZE",
|
||||
copy_mode = "VISUAL",
|
||||
search_mode = "SEARCH",
|
||||
},
|
||||
},
|
||||
},
|
||||
tabs = {
|
||||
numerals = "arabic", -- or "roman"
|
||||
pane_count = "superscript", -- or "subscript", false
|
||||
brackets = {
|
||||
active = { "", ":" },
|
||||
inactive = { "", ":" },
|
||||
},
|
||||
},
|
||||
clock = {
|
||||
enabled = false,
|
||||
format = "%I:%M %P", -- https://docs.rs/chrono/latest/chrono/format/strftime/index.html
|
||||
},
|
||||
}
|
||||
|
||||
-- parsed config
|
||||
local C = {}
|
||||
|
||||
local function tableMerge(t1, t2)
|
||||
for k, v in pairs(t2) do
|
||||
if type(v) == "table" then
|
||||
if type(t1[k] or false) == "table" then
|
||||
tableMerge(t1[k] or {}, t2[k] or {})
|
||||
else
|
||||
t1[k] = v
|
||||
end
|
||||
else
|
||||
t1[k] = v
|
||||
end
|
||||
end
|
||||
return t1
|
||||
end
|
||||
|
||||
local dividers = {
|
||||
slant_right = {
|
||||
left = utf8.char(0xe0be),
|
||||
right = utf8.char(0xe0bc),
|
||||
},
|
||||
slant_left = {
|
||||
left = utf8.char(0xe0bb),
|
||||
right = utf8.char(0xe0b8),
|
||||
},
|
||||
arrows = {
|
||||
left = utf8.char(0xe0b2),
|
||||
right = utf8.char(0xe0b0),
|
||||
},
|
||||
rounded = {
|
||||
left = utf8.char(0xe0b6),
|
||||
right = utf8.char(0xe0b4),
|
||||
},
|
||||
}
|
||||
|
||||
-- conforming to https://github.com/wez/wezterm/commit/e4ae8a844d8feaa43e1de34c5cc8b4f07ce525dd
|
||||
-- exporting an apply_to_config function, even though we don't change the users config
|
||||
M.apply_to_config = function(c, opts)
|
||||
-- make the opts arg optional
|
||||
if not opts then
|
||||
opts = {}
|
||||
end
|
||||
|
||||
-- combine user config with defaults
|
||||
config = tableMerge(config, opts)
|
||||
C.div = {
|
||||
l = "",
|
||||
r = "",
|
||||
}
|
||||
|
||||
if config.dividers then
|
||||
C.div.l = dividers[config.dividers].left
|
||||
C.div.r = dividers[config.dividers].right
|
||||
end
|
||||
|
||||
C.leader = {
|
||||
enabled = config.indicator.leader.enabled and true,
|
||||
off = config.indicator.leader.off,
|
||||
on = config.indicator.leader.on,
|
||||
}
|
||||
|
||||
C.mode = {
|
||||
enabled = config.indicator.mode.enabled,
|
||||
names = config.indicator.mode.names,
|
||||
}
|
||||
|
||||
C.tabs = {
|
||||
numerals = config.tabs.numerals,
|
||||
pane_count_style = config.tabs.pane_count,
|
||||
brackets = {
|
||||
active = config.tabs.brackets.active,
|
||||
inactive = config.tabs.brackets.inactive,
|
||||
},
|
||||
}
|
||||
|
||||
C.clock = {
|
||||
enabled = config.clock.enabled,
|
||||
format = config.clock.format,
|
||||
}
|
||||
|
||||
-- set the right-hand padding to 0 spaces, if the rounded style is active
|
||||
C.p = (config.dividers == "rounded") and "" or " "
|
||||
|
||||
-- set wezterm config options according to the parsed config
|
||||
c.use_fancy_tab_bar = false
|
||||
c.tab_bar_at_bottom = config.position == "bottom"
|
||||
c.tab_max_width = config.max_width
|
||||
end
|
||||
|
||||
-- superscript/subscript
|
||||
local function numberStyle(number, script)
|
||||
local scripts = {
|
||||
superscript = {
|
||||
"⁰",
|
||||
"¹",
|
||||
"²",
|
||||
"³",
|
||||
"⁴",
|
||||
"⁵",
|
||||
"⁶",
|
||||
"⁷",
|
||||
"⁸",
|
||||
"⁹",
|
||||
},
|
||||
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 num = tonumber(char)
|
||||
if num then
|
||||
result = result .. numbers[num + 1]
|
||||
else
|
||||
result = result .. char
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
local roman_numerals = {
|
||||
"Ⅰ",
|
||||
"Ⅱ",
|
||||
"Ⅲ",
|
||||
"Ⅳ",
|
||||
"Ⅴ",
|
||||
"Ⅵ",
|
||||
"Ⅶ",
|
||||
"Ⅷ",
|
||||
"Ⅸ",
|
||||
"Ⅹ",
|
||||
"Ⅺ",
|
||||
"Ⅻ",
|
||||
}
|
||||
|
||||
-- custom tab bar
|
||||
wezterm.on("format-tab-title", function(tab, tabs, _panes, conf, _hover, _max_width)
|
||||
local colours = conf.resolved_palette.tab_bar
|
||||
|
||||
local active_tab_index = 0
|
||||
for _, t in ipairs(tabs) do
|
||||
if t.is_active == true then
|
||||
active_tab_index = t.tab_index
|
||||
end
|
||||
end
|
||||
|
||||
local rainbow = {
|
||||
conf.resolved_palette.ansi[2],
|
||||
conf.resolved_palette.indexed[16],
|
||||
conf.resolved_palette.ansi[4],
|
||||
conf.resolved_palette.ansi[3],
|
||||
conf.resolved_palette.ansi[5],
|
||||
conf.resolved_palette.ansi[6],
|
||||
}
|
||||
|
||||
local i = tab.tab_index % 6
|
||||
local active_bg = rainbow[i + 1]
|
||||
local active_fg = colours.background
|
||||
local inactive_bg = colours.inactive_tab.bg_color
|
||||
local inactive_fg = colours.inactive_tab.fg_color
|
||||
local new_tab_bg = colours.new_tab.bg_color
|
||||
|
||||
local s_bg, s_fg, e_bg, e_fg
|
||||
|
||||
-- the last tab
|
||||
if tab.tab_index == #tabs - 1 then
|
||||
if tab.is_active then
|
||||
s_bg = active_bg
|
||||
s_fg = active_fg
|
||||
e_bg = new_tab_bg
|
||||
e_fg = active_bg
|
||||
else
|
||||
s_bg = inactive_bg
|
||||
s_fg = inactive_fg
|
||||
e_bg = new_tab_bg
|
||||
e_fg = inactive_bg
|
||||
end
|
||||
elseif tab.tab_index == active_tab_index - 1 then
|
||||
s_bg = inactive_bg
|
||||
s_fg = inactive_fg
|
||||
e_bg = rainbow[(i + 1) % 6 + 1]
|
||||
e_fg = inactive_bg
|
||||
elseif tab.is_active then
|
||||
s_bg = active_bg
|
||||
s_fg = active_fg
|
||||
e_bg = inactive_bg
|
||||
e_fg = active_bg
|
||||
else
|
||||
s_bg = inactive_bg
|
||||
s_fg = inactive_fg
|
||||
e_bg = inactive_bg
|
||||
e_fg = inactive_bg
|
||||
end
|
||||
|
||||
local pane_count = ""
|
||||
if C.tabs.pane_count_style then
|
||||
local tabi = wezterm.mux.get_tab(tab.tab_id)
|
||||
local muxpanes = tabi:panes()
|
||||
local count = #muxpanes == 1 and "" or tostring(#muxpanes)
|
||||
pane_count = numberStyle(count, C.tabs.pane_count_style)
|
||||
end
|
||||
|
||||
local index_i
|
||||
if C.tabs.numerals == "roman" then
|
||||
index_i = roman_numerals[tab.tab_index + 1]
|
||||
else
|
||||
index_i = tab.tab_index + 1
|
||||
end
|
||||
|
||||
local index
|
||||
if tab.is_active then
|
||||
index = string.format("%s%s%s ", C.tabs.brackets.active[1], index_i, C.tabs.brackets.active[2])
|
||||
else
|
||||
index = string.format("%s%s%s ", C.tabs.brackets.inactive[1], index_i, C.tabs.brackets.inactive[2])
|
||||
end
|
||||
|
||||
-- start and end hardcoded numbers are the Powerline + " " padding
|
||||
local fillerwidth = 2 + string.len(index) + string.len(pane_count) + 2
|
||||
|
||||
-- prefer renamed table titles to the default title
|
||||
local tabtitle = tab.tab_title
|
||||
if #tabtitle <= 0 then
|
||||
tabtitle = tab.active_pane.title
|
||||
end
|
||||
|
||||
local width = conf.tab_max_width - fillerwidth - 1
|
||||
if (#tabtitle + fillerwidth) > conf.tab_max_width then
|
||||
tabtitle = wezterm.truncate_right(tabtitle, width) .. "…"
|
||||
end
|
||||
|
||||
local title = string.format(" %s%s%s%s", index, tabtitle, pane_count, C.p)
|
||||
|
||||
return {
|
||||
{ Background = { Color = s_bg } },
|
||||
{ Foreground = { Color = s_fg } },
|
||||
{ Text = title },
|
||||
{ Background = { Color = e_bg } },
|
||||
{ Foreground = { Color = e_fg } },
|
||||
{ Text = C.div.r },
|
||||
}
|
||||
end)
|
||||
|
||||
wezterm.on("update-status", function(window, _pane)
|
||||
local active_kt = window:active_key_table() ~= nil
|
||||
local show = C.leader.enabled or (active_kt and C.mode.enabled)
|
||||
if not show then
|
||||
window:set_left_status("")
|
||||
return
|
||||
end
|
||||
|
||||
local present, conf = pcall(window.effective_config, window)
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
local palette = conf.resolved_palette
|
||||
|
||||
local leader = ""
|
||||
if C.leader.enabled then
|
||||
local leader_text = C.leader.off
|
||||
if window:leader_is_active() then
|
||||
leader_text = C.leader.on
|
||||
end
|
||||
leader = wezterm.format({
|
||||
{ Foreground = { Color = palette.background } },
|
||||
{ Background = { Color = palette.ansi[5] } },
|
||||
{ Text = " " .. leader_text .. C.p },
|
||||
})
|
||||
end
|
||||
|
||||
local mode = ""
|
||||
if C.mode.enabled then
|
||||
local mode_text = ""
|
||||
local active = window:active_key_table()
|
||||
if C.mode.names[active] ~= nil then
|
||||
mode_text = C.mode.names[active] .. ""
|
||||
end
|
||||
mode = wezterm.format({
|
||||
{ Foreground = { Color = palette.background } },
|
||||
{ Background = { Color = palette.ansi[5] } },
|
||||
{ Attribute = { Intensity = "Bold" } },
|
||||
{ Text = mode_text },
|
||||
"ResetAttributes",
|
||||
})
|
||||
end
|
||||
|
||||
local first_tab_active = window:mux_window():tabs_with_info()[1].is_active
|
||||
local divider_bg = first_tab_active and palette.ansi[2] or palette.tab_bar.inactive_tab.bg_color
|
||||
|
||||
local divider = wezterm.format({
|
||||
{ Background = { Color = divider_bg } },
|
||||
{ Foreground = { Color = palette.ansi[5] } },
|
||||
{ Text = C.div.r },
|
||||
})
|
||||
|
||||
window:set_left_status(leader .. mode .. divider)
|
||||
|
||||
if C.clock.enabled then
|
||||
local time = wezterm.time.now():format(C.clock.format)
|
||||
window:set_right_status(wezterm.format({
|
||||
{ Background = { Color = palette.tab_bar.background } },
|
||||
{ Foreground = { Color = palette.ansi[6] } },
|
||||
{ Text = time },
|
||||
}))
|
||||
end
|
||||
end)
|
||||
|
||||
return M
|
351
modules/home-manager/cli/wezterm/catppuccin.lua
Normal file
351
modules/home-manager/cli/wezterm/catppuccin.lua
Normal file
|
@ -0,0 +1,351 @@
|
|||
local wezterm = require("wezterm")
|
||||
|
||||
local M = {}
|
||||
|
||||
local colors = {
|
||||
latte = {
|
||||
rosewater = "#dc8a78",
|
||||
flamingo = "#dd7878",
|
||||
pink = "#ea76cb",
|
||||
mauve = "#8839ef",
|
||||
red = "#d20f39",
|
||||
maroon = "#e64553",
|
||||
peach = "#fe640b",
|
||||
yellow = "#df8e1d",
|
||||
green = "#40a02b",
|
||||
teal = "#179299",
|
||||
sky = "#04a5e5",
|
||||
sapphire = "#209fb5",
|
||||
blue = "#1e66f5",
|
||||
lavender = "#7287fd",
|
||||
text = "#4c4f69",
|
||||
subtext1 = "#5c5f77",
|
||||
subtext0 = "#6c6f85",
|
||||
overlay2 = "#7c7f93",
|
||||
overlay1 = "#8c8fa1",
|
||||
overlay0 = "#9ca0b0",
|
||||
surface2 = "#acb0be",
|
||||
surface1 = "#bcc0cc",
|
||||
surface0 = "#ccd0da",
|
||||
crust = "#dce0e8",
|
||||
mantle = "#e6e9ef",
|
||||
base = "#eff1f5",
|
||||
},
|
||||
frappe = {
|
||||
rosewater = "#f2d5cf",
|
||||
flamingo = "#eebebe",
|
||||
pink = "#f4b8e4",
|
||||
mauve = "#ca9ee6",
|
||||
red = "#e78284",
|
||||
maroon = "#ea999c",
|
||||
peach = "#ef9f76",
|
||||
yellow = "#e5c890",
|
||||
green = "#a6d189",
|
||||
teal = "#81c8be",
|
||||
sky = "#99d1db",
|
||||
sapphire = "#85c1dc",
|
||||
blue = "#8caaee",
|
||||
lavender = "#babbf1",
|
||||
text = "#c6d0f5",
|
||||
subtext1 = "#b5bfe2",
|
||||
subtext0 = "#a5adce",
|
||||
overlay2 = "#949cbb",
|
||||
overlay1 = "#838ba7",
|
||||
overlay0 = "#737994",
|
||||
surface2 = "#626880",
|
||||
surface1 = "#51576d",
|
||||
surface0 = "#414559",
|
||||
base = "#303446",
|
||||
mantle = "#292c3c",
|
||||
crust = "#232634",
|
||||
},
|
||||
macchiato = {
|
||||
rosewater = "#f4dbd6",
|
||||
flamingo = "#f0c6c6",
|
||||
pink = "#f5bde6",
|
||||
mauve = "#c6a0f6",
|
||||
red = "#ed8796",
|
||||
maroon = "#ee99a0",
|
||||
peach = "#f5a97f",
|
||||
yellow = "#eed49f",
|
||||
green = "#a6da95",
|
||||
teal = "#8bd5ca",
|
||||
sky = "#91d7e3",
|
||||
sapphire = "#7dc4e4",
|
||||
blue = "#8aadf4",
|
||||
lavender = "#b7bdf8",
|
||||
text = "#cad3f5",
|
||||
subtext1 = "#b8c0e0",
|
||||
subtext0 = "#a5adcb",
|
||||
overlay2 = "#939ab7",
|
||||
overlay1 = "#8087a2",
|
||||
overlay0 = "#6e738d",
|
||||
surface2 = "#5b6078",
|
||||
surface1 = "#494d64",
|
||||
surface0 = "#363a4f",
|
||||
base = "#24273a",
|
||||
mantle = "#1e2030",
|
||||
crust = "#181926",
|
||||
},
|
||||
mocha = {
|
||||
rosewater = "#f5e0dc",
|
||||
flamingo = "#f2cdcd",
|
||||
pink = "#f5c2e7",
|
||||
mauve = "#cba6f7",
|
||||
red = "#f38ba8",
|
||||
maroon = "#eba0ac",
|
||||
peach = "#fab387",
|
||||
yellow = "#f9e2af",
|
||||
green = "#a6e3a1",
|
||||
teal = "#94e2d5",
|
||||
sky = "#89dceb",
|
||||
sapphire = "#74c7ec",
|
||||
blue = "#89b4fa",
|
||||
lavender = "#b4befe",
|
||||
text = "#cdd6f4",
|
||||
subtext1 = "#bac2de",
|
||||
subtext0 = "#a6adc8",
|
||||
overlay2 = "#9399b2",
|
||||
overlay1 = "#7f849c",
|
||||
overlay0 = "#6c7086",
|
||||
surface2 = "#585b70",
|
||||
surface1 = "#45475a",
|
||||
surface0 = "#313244",
|
||||
base = "#1e1e2e",
|
||||
mantle = "#181825",
|
||||
crust = "#11111b",
|
||||
},
|
||||
espresso = {
|
||||
rosewater = "#ece3e1",
|
||||
flamingo = "#e1d2d2",
|
||||
pink = "#ddccd8",
|
||||
mauve = "#bbb2c9",
|
||||
red = "#c4a2aa",
|
||||
maroon = "#cbadb1",
|
||||
peach = "#d5beb4",
|
||||
yellow = "#ece3d3",
|
||||
green = "#b9ddb6",
|
||||
teal = "#badad4",
|
||||
sky = "#b8d4db",
|
||||
sapphire = "#a9c0ce",
|
||||
blue = "#aab3c7",
|
||||
lavender = "#bfc1d2",
|
||||
text = "#d3d6e1",
|
||||
subtext1 = "#bec2d2",
|
||||
subtext0 = "#a8adc3",
|
||||
overlay2 = "#9299b4",
|
||||
overlay1 = "#7c84a5",
|
||||
overlay0 = "#686f94",
|
||||
surface2 = "#555a7b",
|
||||
surface1 = "#434664",
|
||||
surface0 = "#30314b",
|
||||
base = "#101010",
|
||||
mantle = "#090909",
|
||||
crust = "#080808",
|
||||
},
|
||||
evergarden = {
|
||||
rosewater = "#E3A8D1",
|
||||
flamingo = "#E3A8D1",
|
||||
pink = "#E3A8D1",
|
||||
mauve = "#D6A0D1",
|
||||
red = "#E67E80",
|
||||
maroon = "#E67E80",
|
||||
peach = "#E69875",
|
||||
yellow = "#DBBC7F",
|
||||
green = "#B2C98F",
|
||||
teal = "#93C9A1",
|
||||
sky = "#97C9C3",
|
||||
sapphire = "#9BB5CF",
|
||||
blue = "#9BB5CF",
|
||||
lavender = "#D6A0D1",
|
||||
text = "#D9E4DC",
|
||||
subtext1 = "#C9D6D0",
|
||||
subtext0 = "#AEC2BE",
|
||||
overlay2 = "#99ADAD",
|
||||
overlay1 = "#6E8585",
|
||||
overlay0 = "#5E6C70",
|
||||
surface2 = "#46545B",
|
||||
surface1 = "#3D494F",
|
||||
surface0 = "#343E44",
|
||||
base = "#252B2E",
|
||||
mantle = "#1C2225",
|
||||
crust = "#171C1F",
|
||||
},
|
||||
}
|
||||
|
||||
local mappings = {
|
||||
-- custom flavor
|
||||
evergarden = "Evergarden",
|
||||
espresso = "Catppuccin Espresso",
|
||||
-- default flavors
|
||||
mocha = "Catppuccin Mocha",
|
||||
macchiato = "Catppuccin Macchiato",
|
||||
frappe = "Catppuccin Frappe",
|
||||
latte = "Catppuccin Latte",
|
||||
}
|
||||
|
||||
function M.select(palette, flavor, accent)
|
||||
local c = palette[flavor]
|
||||
-- shorthand to check for the Latte flavor
|
||||
local isLatte = palette == "latte"
|
||||
|
||||
return {
|
||||
foreground = c.text,
|
||||
background = c.base,
|
||||
|
||||
cursor_fg = isLatte and c.base or c.crust,
|
||||
cursor_bg = c.rosewater,
|
||||
cursor_border = c.rosewater,
|
||||
|
||||
selection_fg = c.text,
|
||||
selection_bg = c.surface2,
|
||||
|
||||
scrollbar_thumb = c.surface2,
|
||||
|
||||
split = c.overlay0,
|
||||
|
||||
ansi = {
|
||||
isLatte and c.subtext1 or c.surface1,
|
||||
c.red,
|
||||
c.green,
|
||||
c.yellow,
|
||||
c.blue,
|
||||
c.pink,
|
||||
c.teal,
|
||||
isLatte and c.surface2 or c.subtext1,
|
||||
},
|
||||
|
||||
brights = {
|
||||
isLatte and c.subtext0 or c.surface2,
|
||||
c.red,
|
||||
c.green,
|
||||
c.yellow,
|
||||
c.blue,
|
||||
c.pink,
|
||||
c.teal,
|
||||
isLatte and c.surface1 or c.subtext0,
|
||||
},
|
||||
|
||||
indexed = { [16] = c.peach, [17] = c.rosewater },
|
||||
|
||||
-- nightbuild only
|
||||
compose_cursor = c.flamingo,
|
||||
|
||||
tab_bar = {
|
||||
background = c.crust,
|
||||
active_tab = {
|
||||
bg_color = c[accent],
|
||||
fg_color = c.crust,
|
||||
},
|
||||
inactive_tab = {
|
||||
bg_color = c.mantle,
|
||||
fg_color = c.text,
|
||||
},
|
||||
inactive_tab_hover = {
|
||||
bg_color = c.base,
|
||||
fg_color = c.text,
|
||||
},
|
||||
new_tab = {
|
||||
bg_color = c.surface0,
|
||||
fg_color = c.text,
|
||||
},
|
||||
new_tab_hover = {
|
||||
bg_color = c.surface1,
|
||||
fg_color = c.text,
|
||||
},
|
||||
-- fancy tab bar
|
||||
inactive_tab_edge = c.surface0,
|
||||
},
|
||||
|
||||
visual_bell = c.surface0,
|
||||
}
|
||||
end
|
||||
|
||||
local function select_for_appearance(appearance, options)
|
||||
if appearance:find("Dark") then
|
||||
return options.dark
|
||||
else
|
||||
return options.light
|
||||
end
|
||||
end
|
||||
|
||||
local function tableMerge(t1, t2)
|
||||
for k, v in pairs(t2) do
|
||||
if type(v) == "table" then
|
||||
if type(t1[k] or false) == "table" then
|
||||
tableMerge(t1[k] or {}, t2[k] or {})
|
||||
else
|
||||
t1[k] = v
|
||||
end
|
||||
else
|
||||
t1[k] = v
|
||||
end
|
||||
end
|
||||
return t1
|
||||
end
|
||||
|
||||
function M.apply_to_config(c, opts)
|
||||
if not opts then
|
||||
opts = {}
|
||||
end
|
||||
|
||||
-- default options
|
||||
local defaults = {
|
||||
flavor = "mocha",
|
||||
accent = "pink",
|
||||
sync = false,
|
||||
sync_flavors = { light = "latte", dark = "mocha" },
|
||||
color_overrides = { evergarden = {}, espresso = {}, mocha = {}, macchiato = {}, frappe = {}, latte = {} },
|
||||
token_overrides = { evergarden = {}, espresso = {}, mocha = {}, macchiato = {}, frappe = {}, latte = {} },
|
||||
}
|
||||
|
||||
local o = tableMerge(defaults, opts)
|
||||
|
||||
-- insert all flavors
|
||||
local color_schemes = {}
|
||||
local palette = tableMerge(colors, o.color_overrides)
|
||||
for flavor, name in pairs(mappings) do
|
||||
local spec = M.select(palette, flavor, o.accent)
|
||||
local overrides = o.token_overrides[flavor]
|
||||
color_schemes[name] = tableMerge(spec, overrides)
|
||||
end
|
||||
if c.color_schemes == nil then
|
||||
c.color_schemes = {}
|
||||
end
|
||||
c.color_schemes = tableMerge(c.color_schemes, color_schemes)
|
||||
|
||||
if opts.sync then
|
||||
c.color_scheme = select_for_appearance(wezterm.gui.get_appearance(), {
|
||||
dark = mappings[o.sync_flavors.dark],
|
||||
light = mappings[o.sync_flavors.light],
|
||||
})
|
||||
c.command_palette_bg_color = select_for_appearance(wezterm.gui.get_appearance(), {
|
||||
dark = colors[o.sync_flavors.dark].crust,
|
||||
light = colors[o.sync_flavors.light].crust,
|
||||
})
|
||||
c.command_palette_fg_color = select_for_appearance(wezterm.gui.get_appearance(), {
|
||||
dark = colors[o.sync_flavors.dark].text,
|
||||
light = colors[o.sync_flavors.light].text,
|
||||
})
|
||||
else
|
||||
c.color_scheme = mappings[o.flavor]
|
||||
c.command_palette_bg_color = colors[o.flavor].crust
|
||||
c.command_palette_fg_color = colors[o.flavor].text
|
||||
end
|
||||
|
||||
local window_frame = {
|
||||
active_titlebar_bg = colors[o.flavor].crust,
|
||||
active_titlebar_fg = colors[o.flavor].text,
|
||||
inactive_titlebar_bg = colors[o.flavor].crust,
|
||||
inactive_titlebar_fg = colors[o.flavor].text,
|
||||
button_fg = colors[o.flavor].text,
|
||||
button_bg = colors[o.flavor].base,
|
||||
}
|
||||
|
||||
if c.window_frame == nil then
|
||||
c.window_frame = {}
|
||||
end
|
||||
c.window_frame = tableMerge(c.window_frame, window_frame)
|
||||
end
|
||||
|
||||
return M
|
11
modules/home-manager/cli/wezterm/default.nix
Normal file
11
modules/home-manager/cli/wezterm/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ inputs, pkgs, lib, config, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
inputs.wezterm.packages.${pkgs.system}.default
|
||||
];
|
||||
|
||||
xdg.configFile."wezterm" = {
|
||||
source = config.lib.file.mkOutOfStoreSymlink "/home/pingu/.config/nixos/modules/home-manager/cli/wezterm";
|
||||
recursive = true;
|
||||
};
|
||||
}
|
77
modules/home-manager/cli/wezterm/keybinds.lua
Normal file
77
modules/home-manager/cli/wezterm/keybinds.lua
Normal file
|
@ -0,0 +1,77 @@
|
|||
local wezterm = require("wezterm")
|
||||
local act = wezterm.action
|
||||
|
||||
local utils = require("utils")
|
||||
|
||||
local M = {}
|
||||
|
||||
local openUrl = act.QuickSelectArgs({
|
||||
label = "open url",
|
||||
patterns = { "https?://\\S+" },
|
||||
action = wezterm.action_callback(function(window, pane)
|
||||
local url = window:get_selection_text_for_pane(pane)
|
||||
wezterm.open_with(url)
|
||||
end),
|
||||
})
|
||||
|
||||
local changeCtpFlavor = act.InputSelector({
|
||||
title = "Change Catppuccin flavor",
|
||||
choices = {
|
||||
{ label = "Evergarden" },
|
||||
{ label = "Espresso" },
|
||||
{ label = "Mocha" },
|
||||
{ label = "Macchiato" },
|
||||
{ label = "Frappe" },
|
||||
{ label = "Latte" },
|
||||
},
|
||||
action = wezterm.action_callback(function(window, _, _, label)
|
||||
if label then
|
||||
window:set_config_overrides({ color_scheme = "Catppuccin " .. label })
|
||||
end
|
||||
end),
|
||||
})
|
||||
|
||||
local getNewName = act.PromptInputLine({
|
||||
description = "Enter new name for tab",
|
||||
action = wezterm.action_callback(function(window, pane, line)
|
||||
if line then
|
||||
window:active_tab():set_title(line)
|
||||
end
|
||||
end),
|
||||
})
|
||||
|
||||
local keys = {}
|
||||
local map = function(key, mods, action)
|
||||
if type(mods) == "string" then
|
||||
table.insert(keys, { key = key, mods = mods, action = action })
|
||||
elseif type(mods) == "table" then
|
||||
for _, mod in pairs(mods) do
|
||||
table.insert(keys, { key = key, mods = mod, action = action })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
map("Enter", "ALT", act.ToggleFullScreen)
|
||||
|
||||
map("e", "CTRL|SHIFT", getNewName)
|
||||
map("o", { "LEADER", "SUPER" }, openUrl)
|
||||
map("t", "ALT", changeCtpFlavor)
|
||||
|
||||
local mods
|
||||
if utils.is_windows() then
|
||||
mods = "ALT"
|
||||
else
|
||||
mods = "SUPER"
|
||||
end
|
||||
|
||||
M.apply = function(c)
|
||||
c.leader = {
|
||||
key = " ",
|
||||
mods = mods,
|
||||
timeout_milliseconds = math.maxinteger,
|
||||
}
|
||||
c.keys = keys
|
||||
-- c.disable_default_key_bindings = true
|
||||
end
|
||||
|
||||
return M
|
18
modules/home-manager/cli/wezterm/utils.lua
Normal file
18
modules/home-manager/cli/wezterm/utils.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local wezterm = require("wezterm")
|
||||
local M = {}
|
||||
|
||||
M.is_windows = function()
|
||||
return wezterm.target_triple:find("windows") ~= nil
|
||||
end
|
||||
|
||||
---@return boolean
|
||||
M.is_linux = function()
|
||||
return wezterm.target_triple:find("linux") ~= nil
|
||||
end
|
||||
|
||||
---@return boolean
|
||||
M.is_darwin = function()
|
||||
return wezterm.target_triple:find("darwin") ~= nil
|
||||
end
|
||||
|
||||
return M
|
88
modules/home-manager/cli/wezterm/wezterm.lua
Normal file
88
modules/home-manager/cli/wezterm/wezterm.lua
Normal file
|
@ -0,0 +1,88 @@
|
|||
local utils = require("utils")
|
||||
local wezterm = require("wezterm")
|
||||
|
||||
local c = {}
|
||||
if wezterm.c_builder then
|
||||
c = wezterm.config_builder()
|
||||
end
|
||||
|
||||
c.enable_wayland = true
|
||||
|
||||
-- theme
|
||||
require("catppuccin").apply_to_config(c)
|
||||
require("bar").apply_to_config(c)
|
||||
|
||||
if utils.is_linux() then
|
||||
c.window_background_opacity = 0.90
|
||||
elseif utils.is_darwin() then
|
||||
c.window_background_opacity = 0.95
|
||||
c.macos_window_background_blur = 15
|
||||
elseif utils.is_windows() then
|
||||
-- c.window_background_image = "C:\\Users\\Isabel\\Pictures\\wallpapers\\catgirl.jpg"
|
||||
-- c.window_background_image_hsb = {
|
||||
-- brightness = 0.03, -- make the bg darker so we can see what we are doing
|
||||
-- }
|
||||
-- c.win32_system_backdrop = "Tabbed"
|
||||
-- c.window_background_opacity = 0.95
|
||||
end
|
||||
|
||||
-- load my keybinds
|
||||
require("keybinds").apply(c)
|
||||
|
||||
-- default shell
|
||||
if utils.is_linux() or utils.is_darwin() then
|
||||
c.default_prog = { "/etc/profiles/per-user/pingu/bin/fish", "--login" }
|
||||
elseif utils.is_windows() then
|
||||
c.default_prog = { "wsl.exe" }
|
||||
c.default_domain = "WSL:NixOS"
|
||||
c.launch_menu = {
|
||||
{
|
||||
label = "PowerShell",
|
||||
args = { "pwsh.exe", "-NoLogo" },
|
||||
domain = { DomainName = "local" },
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
-- window stuff
|
||||
if utils.is_linux() then
|
||||
c.window_decorations = "TITLE | RESIZE"
|
||||
else
|
||||
c.window_decorations = "RESIZE"
|
||||
end
|
||||
c.window_padding = { left = 10, right = 0, top = 0, bottom = 0 }
|
||||
c.adjust_window_size_when_changing_font_size = false
|
||||
|
||||
-- fonts
|
||||
c.font = wezterm.font_with_fallback({
|
||||
"Maple Mono",
|
||||
"Symbols Nerd Font",
|
||||
})
|
||||
c.font_size = 13
|
||||
c.adjust_window_size_when_changing_font_size = false
|
||||
c.window_frame = {
|
||||
font = wezterm.font("Maple Mono"),
|
||||
font_size = c.font_size,
|
||||
}
|
||||
|
||||
-- QOL
|
||||
c.audible_bell = "Disabled"
|
||||
c.default_cursor_style = "BlinkingBar"
|
||||
c.window_close_confirmation = "NeverPrompt"
|
||||
-- c.prefer_to_spawn_tabs = true
|
||||
|
||||
if utils.is_windows() then
|
||||
c.front_end = "OpenGL"
|
||||
else
|
||||
c.front_end = "WebGpu"
|
||||
end
|
||||
|
||||
-- this is nix so lets not do it
|
||||
-- enable this if i ever setup nix to statically link
|
||||
-- c.automatically_reload_config = false
|
||||
c.check_for_updates = false
|
||||
|
||||
-- TODO:
|
||||
-- https://wezfurlong.org/wezterm/config/lua/config/tiling_desktop_environments.html
|
||||
|
||||
return c
|
Loading…
Add table
Add a link
Reference in a new issue