From 3aabdce72a143d4e0b1bf4af599460c37e1eaa20 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Thu, 15 Aug 2024 07:56:41 +0200 Subject: [PATCH] Update wezterm config --- dot_config/wezterm/wezterm.lua.tmpl | 63 ++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/dot_config/wezterm/wezterm.lua.tmpl b/dot_config/wezterm/wezterm.lua.tmpl index 92f2ce9..3bcc4f3 100644 --- a/dot_config/wezterm/wezterm.lua.tmpl +++ b/dot_config/wezterm/wezterm.lua.tmpl @@ -1,12 +1,73 @@ -- 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 = "GruvboxDarkHard" +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