dotfiles/dot_config/wezterm/wezterm.lua.tmpl

74 lines
1.7 KiB
Cheetah
Raw Normal View History

2024-08-14 14:37:31 +02:00
-- Pull in the wezterm API
local wezterm = require("wezterm")
2024-08-15 07:56:41 +02:00
local act = wezterm.action
2024-08-14 14:37:31 +02:00
-- This will hold the configuration.
local config = wezterm.config_builder()
-- This is where you actually apply your config choices
2024-08-15 07:56:41 +02:00
config.color_scheme = "nord"
2024-08-14 14:37:31 +02:00
config.font = wezterm.font("BrutalistMono Nerd Font")
2024-08-15 07:56:41 +02:00
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),
}),
},
}
2024-08-14 14:37:31 +02:00
-- and finally, return the configuration to wezterm
return config