dotfiles/dot_config/wezterm/wezterm.lua.tmpl

74 lines
1.7 KiB
Cheetah

-- Pull in the wezterm API
local wezterm = require("wezterm")
local act = wezterm.action
-- This will hold the configuration.
local config = wezterm.config_builder()
-- This is where you actually apply your config choices
config.color_scheme = "nord"
config.font = wezterm.font("BrutalistMono Nerd Font")
config.font_size = {{ .fontsize }}.0
-- Spawn a fish shell in login mode
config.default_prog = { '{{ .shell }}', '-l' }
config.window_frame = {
font = wezterm.font("BrutalistMono Nerd Font"),
font_size = {{ .fontsize }}.0,
active_titlebar_bg = "#434C5E",
inactive_titlebar_bg = "#434C5E",
}
function tab_title(tab_info)
local title = tab_info.tab_title
-- if the tab title is explicitly set, take that
if title and #title > 0 then
return title
end
-- Otherwise, use the title from the active pane
-- in that tab
return tab_info.active_pane.title
end
wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
local background = "#4C566A"
local foreground = "#808080"
if tab.is_active then
background = "#5E81AC"
foreground = "#c0c0c0"
end
local title = tab_title(tab)
-- ensure that the titles fit in the available space,
-- and that we have room for the edges.
title = wezterm.truncate_right(title, max_width - 2)
return {
{ Background = { Color = background } },
{ Foreground = { Color = foreground } },
{ Text = title },
}
end)
config.keys = {
{
key = "R",
mods = "CTRL",
action = 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),
}),
},
}
-- and finally, return the configuration to wezterm
return config