wezterm: per-dpi settings
This commit is contained in:
parent
09946832c1
commit
bd8685e275
1 changed files with 179 additions and 175 deletions
|
@ -11,67 +11,67 @@ local config = {}
|
||||||
local nvim_args = { "nvim", "--listen", os.getenv("XDG_RUNTIME_DIR") .. "/nvim-persistent.sock" }
|
local nvim_args = { "nvim", "--listen", os.getenv("XDG_RUNTIME_DIR") .. "/nvim-persistent.sock" }
|
||||||
|
|
||||||
config.exec_domains = {
|
config.exec_domains = {
|
||||||
wezterm.exec_domain("dev", function(cmd)
|
wezterm.exec_domain("dev", function(cmd)
|
||||||
local wrapped = { "ssh", "-t", "dev" }
|
local wrapped = { "ssh", "-t", "dev" }
|
||||||
for _, arg in ipairs(cmd.args or { os.getenv("SHELL") }) do
|
for _, arg in ipairs(cmd.args or { os.getenv("SHELL") }) do
|
||||||
table.insert(wrapped, arg)
|
table.insert(wrapped, arg)
|
||||||
end
|
end
|
||||||
cmd.args = wrapped
|
cmd.args = wrapped
|
||||||
return cmd
|
return cmd
|
||||||
end),
|
end),
|
||||||
wezterm.exec_domain("nemo", function(cmd)
|
wezterm.exec_domain("nemo", function(cmd)
|
||||||
local wrapped = { "ssh", "-t", "nemo" }
|
local wrapped = { "ssh", "-t", "nemo" }
|
||||||
for _, arg in ipairs(cmd.args or { os.getenv("SHELL") }) do
|
for _, arg in ipairs(cmd.args or { os.getenv("SHELL") }) do
|
||||||
table.insert(wrapped, arg)
|
table.insert(wrapped, arg)
|
||||||
end
|
end
|
||||||
cmd.args = wrapped
|
cmd.args = wrapped
|
||||||
return cmd
|
return cmd
|
||||||
end),
|
end),
|
||||||
}
|
}
|
||||||
|
|
||||||
local function activate_nvim(window, pane)
|
local function activate_nvim(window, pane)
|
||||||
wezterm.log_info("nvim")
|
wezterm.log_info("nvim")
|
||||||
for _, t in ipairs(window:mux_window():tabs_with_info()) do
|
for _, t in ipairs(window:mux_window():tabs_with_info()) do
|
||||||
for _, p in ipairs(t.tab:panes()) do
|
for _, p in ipairs(t.tab:panes()) do
|
||||||
if p:get_title() == "nvim" or t.tab:get_title() == "nvim" then
|
if p:get_title() == "nvim" or t.tab:get_title() == "nvim" then
|
||||||
window:perform_action(
|
window:perform_action(
|
||||||
act.Multiple({
|
act.Multiple({
|
||||||
act.ActivateTab(t.index),
|
act.ActivateTab(t.index),
|
||||||
act.MoveTab(0),
|
act.MoveTab(0),
|
||||||
}),
|
}),
|
||||||
pane
|
pane
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local nvim_tab, nvim_pane, _ = window:mux_window():spawn_tab({ args = nvim_args })
|
local nvim_tab, nvim_pane, _ = window:mux_window():spawn_tab({ args = nvim_args })
|
||||||
window:perform_action(act.MoveTab(0), nvim_pane)
|
window:perform_action(act.MoveTab(0), nvim_pane)
|
||||||
nvim_tab:set_title("nvim")
|
nvim_tab:set_title("nvim")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function activate_tab(title, index)
|
local function activate_tab(title, index)
|
||||||
return function(window, pane)
|
return function(window, pane)
|
||||||
wezterm.log_info(title)
|
wezterm.log_info(title)
|
||||||
for _, t in ipairs(window:mux_window():tabs_with_info()) do
|
for _, t in ipairs(window:mux_window():tabs_with_info()) do
|
||||||
if t.tab:get_title() == title then
|
if t.tab:get_title() == title then
|
||||||
window:perform_action(
|
window:perform_action(
|
||||||
act.Multiple({
|
act.Multiple({
|
||||||
act.ActivateTab(t.index),
|
act.ActivateTab(t.index),
|
||||||
act.MoveTab(index),
|
act.MoveTab(index),
|
||||||
}),
|
}),
|
||||||
pane
|
pane
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local tab, _, _ = window:mux_window():spawn_tab({
|
local tab, _, _ = window:mux_window():spawn_tab({
|
||||||
cwd = "~",
|
cwd = "~",
|
||||||
})
|
})
|
||||||
tab:set_title(title)
|
tab:set_title(title)
|
||||||
window:perform_action(act.MoveTab(index), pane)
|
window:perform_action(act.MoveTab(index), pane)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
wezterm.on("activate-nvim", activate_nvim)
|
wezterm.on("activate-nvim", activate_nvim)
|
||||||
|
@ -86,41 +86,41 @@ wezterm.on("tab-9", activate_tab("t9", 8))
|
||||||
wezterm.on("tab-10", activate_tab("t10", 9))
|
wezterm.on("tab-10", activate_tab("t10", 9))
|
||||||
|
|
||||||
wezterm.on("user-var-changed", function(window, pane, name, _)
|
wezterm.on("user-var-changed", function(window, pane, name, _)
|
||||||
if name == "nvim_activate" then
|
if name == "nvim_activate" then
|
||||||
activate_nvim(window, pane)
|
activate_nvim(window, pane)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- ------------------------------------------------------------------------------------
|
-- ------------------------------------------------------------------------------------
|
||||||
-- Appearance
|
-- Appearance
|
||||||
|
|
||||||
local function colors_for_appearance(appearance)
|
local function colors_for_appearance(appearance)
|
||||||
if appearance:find("Dark") then
|
if appearance:find("Dark") then
|
||||||
return {
|
return {
|
||||||
background = "#0d1117",
|
background = "#0d1117",
|
||||||
-- background = "#000000",
|
-- background = "#000000",
|
||||||
foreground = "#b2b2b2",
|
foreground = "#b2b2b2",
|
||||||
cursor_bg = "#00d992",
|
cursor_bg = "#00d992",
|
||||||
cursor_fg = "#000000",
|
cursor_fg = "#000000",
|
||||||
cursor_border = "#000000",
|
cursor_border = "#000000",
|
||||||
selection_bg = "#d7d7d7",
|
selection_bg = "#d7d7d7",
|
||||||
selection_fg = "#000000",
|
selection_fg = "#000000",
|
||||||
ansi = { "#000000", "#ff0035", "#85ff00", "#ffc900", "#00a7ff", "#cb01ff", "#00e0ff", "#f0f0f0" },
|
ansi = { "#000000", "#ff0035", "#85ff00", "#ffc900", "#00a7ff", "#cb01ff", "#00e0ff", "#f0f0f0" },
|
||||||
brights = { "#000000", "#ff8c88", "#baff94", "#ffe090", "#88ccff", "#e38dff", "#97eeff", "#ffffff" },
|
brights = { "#000000", "#ff8c88", "#baff94", "#ffe090", "#88ccff", "#e38dff", "#97eeff", "#ffffff" },
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return {
|
return {
|
||||||
background = "#fefeff",
|
background = "#fefeff",
|
||||||
foreground = "#222222",
|
foreground = "#222222",
|
||||||
cursor_bg = "#aa0000",
|
cursor_bg = "#aa0000",
|
||||||
cursor_fg = "#ffffff",
|
cursor_fg = "#ffffff",
|
||||||
cursor_border = "#ffffff",
|
cursor_border = "#ffffff",
|
||||||
selection_bg = "#ffe6a4",
|
selection_bg = "#ffe6a4",
|
||||||
selection_fg = "#483600",
|
selection_fg = "#483600",
|
||||||
ansi = { "#000000", "#9e001d", "#306300", "#deae00", "#00669e", "#7d009e", "#008a9e", "#f7f7f7" },
|
ansi = { "#000000", "#9e001d", "#306300", "#deae00", "#00669e", "#7d009e", "#008a9e", "#f7f7f7" },
|
||||||
brights = { "#000000", "#ff0035", "#509e00", "#ffc900", "#00a7ff", "#cb01ff", "#00e0ff", "#ffffff" },
|
brights = { "#000000", "#ff0035", "#509e00", "#ffc900", "#00a7ff", "#cb01ff", "#00e0ff", "#ffffff" },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
config.colors = colors_for_appearance(wezterm.gui.get_appearance())
|
config.colors = colors_for_appearance(wezterm.gui.get_appearance())
|
||||||
|
@ -128,56 +128,60 @@ config.colors = colors_for_appearance(wezterm.gui.get_appearance())
|
||||||
-- ------------------------------------------------------------------------------------
|
-- ------------------------------------------------------------------------------------
|
||||||
-- Fonts
|
-- Fonts
|
||||||
local berkeley_mono_features = {
|
local berkeley_mono_features = {
|
||||||
-- "calt=1",
|
-- "calt=1",
|
||||||
-- "dlig=0",
|
-- "dlig=0",
|
||||||
-- "liga",
|
-- "liga",
|
||||||
-- "calt=1",
|
-- "calt=1",
|
||||||
-- "clig=1",
|
-- "clig=1",
|
||||||
-- "ss02", -- Clean Zero
|
-- "ss02", -- Clean Zero
|
||||||
"ss03", -- Slashed Zero
|
"ss03", -- Slashed Zero
|
||||||
-- "ss04", -- Cut Zero
|
-- "ss04", -- Cut Zero
|
||||||
}
|
}
|
||||||
|
|
||||||
-- #[ ## ### #### ################
|
-- #[ ## ### #### ################
|
||||||
|
|
||||||
config.font = wezterm.font({
|
config.font = wezterm.font({
|
||||||
family = "Berkeley Mono Nerd Font",
|
family = "Berkeley Mono Nerd Font",
|
||||||
weight = "Regular",
|
weight = "Regular",
|
||||||
harfbuzz_features = berkeley_mono_features,
|
harfbuzz_features = berkeley_mono_features,
|
||||||
})
|
})
|
||||||
config.font_rules = {
|
config.font_rules = {
|
||||||
{
|
{
|
||||||
italic = true,
|
italic = true,
|
||||||
intensity = "Bold",
|
intensity = "Bold",
|
||||||
reverse = false,
|
reverse = false,
|
||||||
-- font = wezterm.font("Iosevka Term SS15 Lt Ex Obl", { weight = "Light", italic = true }),
|
-- font = wezterm.font("Iosevka Term SS15 Lt Ex Obl", { weight = "Light", italic = true }),
|
||||||
-- font = wezterm.font("Iosevka Term Curly Slab Lt Ex", { weight = "Light", italic = true }),
|
-- font = wezterm.font("Iosevka Term Curly Slab Lt Ex", { weight = "Light", italic = true }),
|
||||||
-- font = wezterm.font("Iosevka Term Curly Slab Ex", { weight = "Light", italic = true }),
|
-- font = wezterm.font("Iosevka Term Curly Slab Ex", { weight = "Light", italic = true }),
|
||||||
-- font = wezterm.font("Monaspace Radon Var", { weight = "Regular", italic = false }),
|
-- font = wezterm.font("Monaspace Radon Var", { weight = "Regular", italic = false }),
|
||||||
font = wezterm.font({
|
font = wezterm.font({
|
||||||
family = "Berkeley Mono Nerd Font",
|
family = "Berkeley Mono Nerd Font",
|
||||||
italic = true,
|
italic = true,
|
||||||
harfbuzz_features = berkeley_mono_features,
|
harfbuzz_features = berkeley_mono_features,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
wezterm.on("window-config-reloaded", function(window, pane)
|
wezterm.on("window-config-reloaded", function(window, pane)
|
||||||
local overrides = window:get_config_overrides() or {}
|
local overrides = window:get_config_overrides() or {}
|
||||||
local dpi = wezterm.gui.screens().active.effective_dpi
|
local dpi = wezterm.gui.screens().active.effective_dpi
|
||||||
|
|
||||||
if dpi > 96 then
|
if dpi > 96 then
|
||||||
overrides.font_size = 14
|
overrides.font_size = 14
|
||||||
else
|
overrides.freetype_load_target = "Normal"
|
||||||
overrides.font_size = 18
|
-- overrides.cell_width = 0.95
|
||||||
end
|
overrides.cell_width = 1.0
|
||||||
window:set_config_overrides(overrides)
|
else
|
||||||
|
overrides.font_size = 18
|
||||||
|
overrides.freetype_load_target = "HorizontalLcd"
|
||||||
|
end
|
||||||
|
window:set_config_overrides(overrides)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
config.font_size = 14
|
||||||
config.warn_about_missing_glyphs = false
|
config.warn_about_missing_glyphs = false
|
||||||
config.bold_brightens_ansi_colors = false
|
config.bold_brightens_ansi_colors = false
|
||||||
config.unicode_version = 14
|
config.unicode_version = 14
|
||||||
config.freetype_load_target = "HorizontalLcd"
|
|
||||||
|
|
||||||
config.custom_block_glyphs = false
|
config.custom_block_glyphs = false
|
||||||
config.allow_square_glyphs_to_overflow_width = "Always"
|
config.allow_square_glyphs_to_overflow_width = "Always"
|
||||||
|
@ -199,28 +203,28 @@ config.adjust_window_size_when_changing_font_size = false
|
||||||
config.use_resize_increments = true
|
config.use_resize_increments = true
|
||||||
config.window_decorations = "RESIZE"
|
config.window_decorations = "RESIZE"
|
||||||
config.window_frame = {
|
config.window_frame = {
|
||||||
border_left_width = "4px",
|
border_left_width = "4px",
|
||||||
border_right_width = "4px",
|
border_right_width = "4px",
|
||||||
border_bottom_height = "4px",
|
border_bottom_height = "4px",
|
||||||
border_top_height = "4px",
|
border_top_height = "4px",
|
||||||
border_left_color = "#000000",
|
border_left_color = "#000000",
|
||||||
border_right_color = "#000000",
|
border_right_color = "#000000",
|
||||||
border_bottom_color = "#000000",
|
border_bottom_color = "#000000",
|
||||||
border_top_color = "#000000",
|
border_top_color = "#000000",
|
||||||
}
|
}
|
||||||
config.window_padding = {
|
config.window_padding = {
|
||||||
left = 10,
|
left = 10,
|
||||||
right = 10,
|
right = 10,
|
||||||
top = 0,
|
top = 0,
|
||||||
bottom = 0,
|
bottom = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Hyperlinks
|
-- Hyperlinks
|
||||||
config.hyperlink_rules = wezterm.default_hyperlink_rules()
|
config.hyperlink_rules = wezterm.default_hyperlink_rules()
|
||||||
|
|
||||||
table.insert(config.hyperlink_rules, {
|
table.insert(config.hyperlink_rules, {
|
||||||
regex = [[E(\d+)]],
|
regex = [[E(\d+)]],
|
||||||
format = "https://doc.rust-lang.org/error_codes/E$1.html",
|
format = "https://doc.rust-lang.org/error_codes/E$1.html",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Tabs
|
-- Tabs
|
||||||
|
@ -245,54 +249,54 @@ config.alternate_buffer_wheel_scroll_speed = 1
|
||||||
-- Keys
|
-- Keys
|
||||||
config.disable_default_key_bindings = true
|
config.disable_default_key_bindings = true
|
||||||
config.keys = {
|
config.keys = {
|
||||||
{ key = "c", mods = "ALT|SHIFT", action = act.CopyTo("ClipboardAndPrimarySelection") },
|
{ key = "c", mods = "ALT|SHIFT", action = act.CopyTo("ClipboardAndPrimarySelection") },
|
||||||
{ key = "v", mods = "ALT|SHIFT", action = act.PasteFrom("Clipboard") },
|
{ key = "v", mods = "ALT|SHIFT", action = act.PasteFrom("Clipboard") },
|
||||||
{ key = "0", mods = "CTRL", action = "ResetFontSize" },
|
{ key = "0", mods = "CTRL", action = "ResetFontSize" },
|
||||||
{ key = "-", mods = "CTRL", action = "DecreaseFontSize" },
|
{ key = "-", mods = "CTRL", action = "DecreaseFontSize" },
|
||||||
{ key = "=", mods = "CTRL", action = "IncreaseFontSize" },
|
{ key = "=", mods = "CTRL", action = "IncreaseFontSize" },
|
||||||
{ key = "UpArrow", mods = "CTRL", action = act.ScrollToPrompt(-1) },
|
{ key = "UpArrow", mods = "CTRL", action = act.ScrollToPrompt(-1) },
|
||||||
{ key = "DownArrow", mods = "CTRL", action = act.ScrollToPrompt(1) },
|
{ key = "DownArrow", mods = "CTRL", action = act.ScrollToPrompt(1) },
|
||||||
{ key = "UpArrow", mods = "SHIFT", action = act.ScrollByLine(-1) },
|
{ key = "UpArrow", mods = "SHIFT", action = act.ScrollByLine(-1) },
|
||||||
{ key = "DownArrow", mods = "SHIFT", action = act.ScrollByLine(1) },
|
{ key = "DownArrow", mods = "SHIFT", action = act.ScrollByLine(1) },
|
||||||
{ key = "PageUp", mods = "SHIFT", action = act.ScrollByPage(-0.5) },
|
{ key = "PageUp", mods = "SHIFT", action = act.ScrollByPage(-0.5) },
|
||||||
{ key = "PageDown", mods = "SHIFT", action = act.ScrollByPage(0.5) },
|
{ key = "PageDown", mods = "SHIFT", action = act.ScrollByPage(0.5) },
|
||||||
{ key = "r", mods = "ALT", action = act.ReloadConfiguration },
|
{ key = "r", mods = "ALT", action = act.ReloadConfiguration },
|
||||||
{ key = "o", mods = "ALT", action = act.ActivateCommandPalette },
|
{ key = "o", mods = "ALT", action = act.ActivateCommandPalette },
|
||||||
{ key = "RightArrow", mods = "CTRL", action = act.ActivateTabRelative(1) },
|
{ key = "RightArrow", mods = "CTRL", action = act.ActivateTabRelative(1) },
|
||||||
{ key = "LeftArrow", mods = "CTRL", action = act.ActivateTabRelative(-1) },
|
{ key = "LeftArrow", mods = "CTRL", action = act.ActivateTabRelative(-1) },
|
||||||
{ key = "Backspace", mods = "ALT", action = act.SwitchWorkspaceRelative(1) },
|
{ key = "Backspace", mods = "ALT", action = act.SwitchWorkspaceRelative(1) },
|
||||||
{ key = "1", mods = "ALT", action = act.EmitEvent("activate-nvim") },
|
{ key = "1", mods = "ALT", action = act.EmitEvent("activate-nvim") },
|
||||||
{ key = "2", mods = "ALT", action = act.EmitEvent("tab-2") },
|
{ key = "2", mods = "ALT", action = act.EmitEvent("tab-2") },
|
||||||
{ key = "3", mods = "ALT", action = act.EmitEvent("tab-3") },
|
{ key = "3", mods = "ALT", action = act.EmitEvent("tab-3") },
|
||||||
{ key = "4", mods = "ALT", action = act.EmitEvent("tab-4") },
|
{ key = "4", mods = "ALT", action = act.EmitEvent("tab-4") },
|
||||||
{ key = "5", mods = "ALT", action = act.EmitEvent("tab-5") },
|
{ key = "5", mods = "ALT", action = act.EmitEvent("tab-5") },
|
||||||
{ key = "6", mods = "ALT", action = act.EmitEvent("tab-6") },
|
{ key = "6", mods = "ALT", action = act.EmitEvent("tab-6") },
|
||||||
{ key = "7", mods = "ALT", action = act.EmitEvent("tab-7") },
|
{ key = "7", mods = "ALT", action = act.EmitEvent("tab-7") },
|
||||||
{ key = "8", mods = "ALT", action = act.EmitEvent("tab-8") },
|
{ key = "8", mods = "ALT", action = act.EmitEvent("tab-8") },
|
||||||
{ key = "9", mods = "ALT", action = act.EmitEvent("tab-9") },
|
{ key = "9", mods = "ALT", action = act.EmitEvent("tab-9") },
|
||||||
{ key = "0", mods = "ALT", action = act.EmitEvent("tab-10") },
|
{ key = "0", mods = "ALT", action = act.EmitEvent("tab-10") },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Mouse
|
-- Mouse
|
||||||
config.mouse_bindings = {
|
config.mouse_bindings = {
|
||||||
{
|
{
|
||||||
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
|
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
|
||||||
mods = "SHIFT",
|
mods = "SHIFT",
|
||||||
action = act.ScrollByLine(-5),
|
action = act.ScrollByLine(-5),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
|
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
|
||||||
mods = "SHIFT",
|
mods = "SHIFT",
|
||||||
action = act.ScrollByLine(5),
|
action = act.ScrollByLine(5),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
|
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
|
||||||
action = act.ScrollByLine(-1),
|
action = act.ScrollByLine(-1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
|
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
|
||||||
action = act.ScrollByLine(1),
|
action = act.ScrollByLine(1),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
Loading…
Reference in a new issue