2022-12-03 14:42:03 +01:00
|
|
|
local wezterm = require("wezterm")
|
2023-03-07 10:42:16 +01:00
|
|
|
local mux = wezterm.mux
|
|
|
|
local act = wezterm.action
|
2021-04-01 16:02:19 +02:00
|
|
|
|
2023-03-07 16:53:50 +01:00
|
|
|
local function font_with_fallback(name, params)
|
2023-03-07 10:42:16 +01:00
|
|
|
local names = { name, "Noto Color Emoji" }
|
2022-12-03 14:42:03 +01:00
|
|
|
return wezterm.font_with_fallback(names, params)
|
2021-04-01 16:02:19 +02:00
|
|
|
end
|
|
|
|
|
2023-03-07 16:53:50 +01:00
|
|
|
wezterm.on("gui-startup", function(cmd)
|
2023-03-08 20:58:53 +01:00
|
|
|
local _, _, local_win = mux.spawn_window({
|
|
|
|
workspace = "default",
|
|
|
|
})
|
|
|
|
|
|
|
|
mux.spawn_window({
|
|
|
|
workspace = "dln-dev",
|
|
|
|
domain = { DomainName = "dln-dev" },
|
|
|
|
})
|
|
|
|
|
|
|
|
mux.set_active_workspace("default")
|
2023-03-07 16:53:50 +01:00
|
|
|
end)
|
|
|
|
|
2023-03-07 10:42:16 +01:00
|
|
|
wezterm.on("mux-startup", function()
|
2023-03-08 20:58:53 +01:00
|
|
|
local _, _, dev_win = mux.spawn_window({
|
|
|
|
workspace = "dln-dev",
|
|
|
|
})
|
2023-03-07 10:42:16 +01:00
|
|
|
end)
|
2023-01-27 09:46:22 +01:00
|
|
|
|
2023-03-07 16:53:50 +01:00
|
|
|
local function scheme_for_appearance(appearance)
|
2023-03-07 10:42:16 +01:00
|
|
|
if appearance:find("Dark") then
|
|
|
|
return "Shelman Dark"
|
|
|
|
else
|
2023-03-07 16:53:50 +01:00
|
|
|
return "Shelman Light"
|
2023-03-07 10:42:16 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-03-07 16:53:50 +01:00
|
|
|
local function _get_scheme()
|
|
|
|
-- if wezterm.gui then
|
|
|
|
-- return return scheme_for_appearance(wezterm.gui.get_appearance())
|
|
|
|
-- end
|
|
|
|
return "Shelman Dark"
|
|
|
|
end
|
|
|
|
|
2023-03-07 10:42:16 +01:00
|
|
|
local is_server = wezterm.hostname() == "dln-dev"
|
2021-04-03 10:19:45 +02:00
|
|
|
|
2023-03-08 22:59:58 +01:00
|
|
|
local function activate_nvim(window, pane)
|
|
|
|
wezterm.log_info("activate_nvim")
|
|
|
|
for _, t in ipairs(window:mux_window():tabs_with_info()) do
|
|
|
|
for _, p in ipairs(t.tab:panes()) do
|
|
|
|
if p:get_title() == "nvim" then
|
|
|
|
window:perform_action(
|
|
|
|
act.Multiple({
|
|
|
|
act.ActivateTab(t.index),
|
|
|
|
act.MoveTab(0),
|
|
|
|
}),
|
|
|
|
pane
|
|
|
|
)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-03-07 22:56:45 +01:00
|
|
|
wezterm.on("user-var-changed", function(window, pane, name, value)
|
|
|
|
wezterm.log_info("user-var-changed", name, value)
|
|
|
|
|
|
|
|
if name == "nvim_activate" then
|
2023-03-08 22:59:58 +01:00
|
|
|
activate_nvim(window, pane)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
local function activate_tab(title, index)
|
|
|
|
return function(window, pane)
|
|
|
|
wezterm.log_info(title)
|
2023-03-07 22:56:45 +01:00
|
|
|
for _, t in ipairs(window:mux_window():tabs_with_info()) do
|
2023-03-08 22:59:58 +01:00
|
|
|
if t.tab:get_title() == title then
|
|
|
|
window:perform_action(
|
|
|
|
act.Multiple({
|
|
|
|
act.ActivateTab(t.index),
|
|
|
|
act.MoveTab(index),
|
|
|
|
}),
|
|
|
|
pane
|
|
|
|
)
|
|
|
|
return
|
2023-03-07 22:56:45 +01:00
|
|
|
end
|
|
|
|
end
|
2023-03-08 22:59:58 +01:00
|
|
|
local tab, _, _ = window:mux_window():spawn_tab({})
|
|
|
|
tab:set_title(title)
|
|
|
|
window:perform_action(act.MoveTab(index), pane)
|
2023-03-07 22:56:45 +01:00
|
|
|
end
|
2023-03-08 22:59:58 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
wezterm.on("tab-1", activate_nvim)
|
|
|
|
wezterm.on("tab-2", activate_tab("t2", 1))
|
|
|
|
wezterm.on("tab-3", activate_tab("t3", 2))
|
|
|
|
wezterm.on("tab-4", activate_tab("t4", 3))
|
|
|
|
wezterm.on("tab-5", activate_tab("t5", 4))
|
|
|
|
wezterm.on("tab-6", activate_tab("t6", 5))
|
|
|
|
wezterm.on("tab-7", activate_tab("t7", 6))
|
|
|
|
wezterm.on("tab-8", activate_tab("t8", 7))
|
|
|
|
wezterm.on("tab-9", activate_tab("t9", 8))
|
|
|
|
wezterm.on("tab-10", activate_tab("t10", 9))
|
2023-03-07 22:56:45 +01:00
|
|
|
|
2021-04-01 16:02:19 +02:00
|
|
|
return {
|
2023-03-07 16:53:50 +01:00
|
|
|
color_scheme = _get_scheme(),
|
2023-03-07 10:42:16 +01:00
|
|
|
color_scheme_dirs = { "/home/dln/.config/wezterm" },
|
2022-12-06 17:19:07 +01:00
|
|
|
font = font_with_fallback("Iosevka Shelman SS09", { weight = "Regular" }),
|
2022-12-03 14:42:03 +01:00
|
|
|
font_rules = {
|
|
|
|
{
|
|
|
|
italic = false,
|
|
|
|
intensity = "Half",
|
2022-12-06 17:19:07 +01:00
|
|
|
font = font_with_fallback("Iosevka Shelman SS09", { weight = "Thin" }),
|
2022-12-03 14:42:03 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
italic = true,
|
|
|
|
intensity = "Normal",
|
2022-12-06 17:19:07 +01:00
|
|
|
font = font_with_fallback("Iosevka Shelman Curly Slab", { weight = "Light", italic = true }),
|
2022-12-03 14:42:03 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
italic = true,
|
|
|
|
intensity = "Bold",
|
2022-12-06 17:19:07 +01:00
|
|
|
font = font_with_fallback("Iosevka Shelman SS15", { weight = "ExtraLight", italic = true }),
|
2022-12-03 14:42:03 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
intensity = "Bold",
|
2022-12-06 17:19:07 +01:00
|
|
|
font = font_with_fallback("Iosevka Shelman SS09", { weight = "DemiBold" }),
|
2022-12-03 14:42:03 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
freetype_load_target = "Light",
|
2022-12-06 17:19:07 +01:00
|
|
|
freetype_render_target = "HorizontalLcd",
|
|
|
|
--freetype_load_flags = "NO_HINTING",
|
|
|
|
--custom_block_glyphs = false,
|
|
|
|
|
2022-12-03 14:42:03 +01:00
|
|
|
warn_about_missing_glyphs = false,
|
|
|
|
bold_brightens_ansi_colors = false,
|
2022-12-06 17:19:07 +01:00
|
|
|
allow_square_glyphs_to_overflow_width = "Always",
|
2023-03-07 10:42:16 +01:00
|
|
|
font_size = 13.5,
|
2022-12-06 17:19:07 +01:00
|
|
|
line_height = 1.0,
|
2023-03-07 10:42:16 +01:00
|
|
|
cell_width = 0.95,
|
|
|
|
-- initial_cols = 128,
|
|
|
|
-- initial_rows = 45,
|
|
|
|
use_resize_increments = true,
|
|
|
|
window_background_opacity = 1.0,
|
2023-01-27 09:46:22 +01:00
|
|
|
window_padding = {
|
2023-03-07 10:42:16 +01:00
|
|
|
left = "0.75cell",
|
|
|
|
right = "0.5cell",
|
|
|
|
top = "0.25cell",
|
|
|
|
bottom = "0cell",
|
|
|
|
},
|
|
|
|
colors = {
|
|
|
|
tab_bar = {
|
|
|
|
active_tab = {
|
|
|
|
fg_color = "#e0e0e0",
|
|
|
|
bg_color = "#374f66",
|
|
|
|
},
|
|
|
|
},
|
2023-01-27 09:46:22 +01:00
|
|
|
},
|
2022-12-06 17:19:07 +01:00
|
|
|
window_decorations = "RESIZE",
|
|
|
|
window_frame = {
|
|
|
|
border_left_width = "2px",
|
|
|
|
border_right_width = "2px",
|
|
|
|
border_bottom_height = "2px",
|
|
|
|
border_top_height = "2px",
|
2023-03-07 10:42:16 +01:00
|
|
|
border_left_color = "#333333",
|
|
|
|
border_right_color = "#333333",
|
|
|
|
border_bottom_color = "#333333",
|
|
|
|
border_top_color = "#333333",
|
|
|
|
inactive_titlebar_bg = "#21262e",
|
|
|
|
active_titlebar_bg = "#252b34",
|
2022-12-03 14:42:03 +01:00
|
|
|
},
|
|
|
|
default_cursor_style = "SteadyBlock",
|
|
|
|
cursor_thickness = "3px",
|
2023-01-27 09:46:22 +01:00
|
|
|
cursor_blink_rate = 300,
|
2022-12-03 14:42:03 +01:00
|
|
|
enable_wayland = true,
|
2023-03-07 23:04:13 +01:00
|
|
|
enable_tab_bar = false,
|
2022-12-03 14:42:03 +01:00
|
|
|
tab_bar_at_bottom = true,
|
2023-03-07 10:42:16 +01:00
|
|
|
use_fancy_tab_bar = true,
|
2022-12-03 14:42:03 +01:00
|
|
|
show_tab_index_in_tab_bar = true,
|
|
|
|
enable_scroll_bar = false,
|
|
|
|
scrollback_lines = 5000,
|
|
|
|
alternate_buffer_wheel_scroll_speed = 2,
|
|
|
|
check_for_updates = false,
|
|
|
|
status_update_interval = 100,
|
|
|
|
audible_bell = "Disabled",
|
|
|
|
term = "wezterm",
|
|
|
|
disable_default_key_bindings = true,
|
|
|
|
keys = {
|
2023-03-07 10:42:16 +01:00
|
|
|
{ key = "c", mods = "ALT|SHIFT", action = act({ CopyTo = "ClipboardAndPrimarySelection" }) },
|
2022-12-03 14:42:03 +01:00
|
|
|
{ key = "v", mods = "ALT|SHIFT", action = "Paste" },
|
|
|
|
{ key = "0", mods = "CTRL", action = "ResetFontSize" },
|
|
|
|
{ key = "-", mods = "CTRL", action = "DecreaseFontSize" },
|
|
|
|
{ key = "=", mods = "CTRL", action = "IncreaseFontSize" },
|
|
|
|
{ key = "Enter", mods = "ALT", action = "ToggleFullScreen" },
|
2023-03-07 10:42:16 +01:00
|
|
|
{ key = "r", mods = "ALT", action = act.ReloadConfiguration },
|
|
|
|
-- mux
|
|
|
|
{ key = "E", mods = "CTRL|SHIFT", action = act.DetachDomain({ DomainName = "dln-dev" }) },
|
2023-03-08 22:59:58 +01:00
|
|
|
{ key = "1", mods = "ALT", action = act.EmitEvent("tab-1") },
|
|
|
|
{ key = "2", mods = "ALT", action = act.EmitEvent("tab-2") },
|
|
|
|
{ key = "3", mods = "ALT", action = act.EmitEvent("tab-3") },
|
|
|
|
{ key = "4", mods = "ALT", action = act.EmitEvent("tab-4") },
|
|
|
|
{ key = "5", mods = "ALT", action = act.EmitEvent("tab-5") },
|
|
|
|
{ key = "6", mods = "ALT", action = act.EmitEvent("tab-6") },
|
|
|
|
{ key = "7", mods = "ALT", action = act.EmitEvent("tab-7") },
|
|
|
|
{ key = "8", mods = "ALT", action = act.EmitEvent("tab-8") },
|
|
|
|
{ key = "9", mods = "ALT", action = act.EmitEvent("tab-9") },
|
|
|
|
{ key = "0", mods = "ALT", action = act.EmitEvent("tab-10") },
|
2023-03-07 22:56:45 +01:00
|
|
|
{ key = "RightArrow", mods = "CTRL", action = act.ActivateTabRelative(1) },
|
|
|
|
{ key = "LeftArrow", mods = "CTRL", action = act.ActivateTabRelative(-1) },
|
2023-03-08 12:59:55 +01:00
|
|
|
{ key = "l", mods = "ALT", action = wezterm.action.ShowLauncher },
|
2023-03-08 20:58:53 +01:00
|
|
|
{ key = "Backspace", mods = "ALT", action = act.SwitchWorkspaceRelative(1) },
|
2023-03-07 10:42:16 +01:00
|
|
|
},
|
|
|
|
unix_domains = {
|
|
|
|
{
|
|
|
|
name = "dln-dev",
|
|
|
|
local_echo_threshold_ms = 100,
|
2023-03-07 16:53:50 +01:00
|
|
|
proxy_command = is_server == false and { "ssh", "dln-dev", "wezterm", "cli", "proxy" } or nil,
|
2023-03-07 10:42:16 +01:00
|
|
|
},
|
2022-12-03 14:42:03 +01:00
|
|
|
},
|
2021-04-01 16:02:19 +02:00
|
|
|
}
|