From 31402935524169c9b95277a4462411cb5df3c5aa Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Wed, 18 Jan 2023 20:18:12 +0100 Subject: [PATCH] wezterm: Update tabstyle --- home/config/wezterm/config.fnl | 59 ++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/home/config/wezterm/config.fnl b/home/config/wezterm/config.fnl index 73494e6..f2519e0 100644 --- a/home/config/wezterm/config.fnl +++ b/home/config/wezterm/config.fnl @@ -1,5 +1,55 @@ (let [wezterm (require :wezterm) - window-padding 15] + window-padding 15 + colors {:active-background "#282A36" + :active-foreground "#ABB2BF" + :active-indicator "#BD93F9" + :inactive-background "#191A21" + :inactive-foreground "#6272A4"}] + ;; Event: Tab format + + (fn extract-tab-info [title] + (match title + (where t (t:find "^nvim%s")) + {:title (title:gsub "^nvim%s(.*)" "%1") :icon " " :color "#019833"} + (where t (t:find "^upa%s")) {: title :icon " " :color "#7EBAE4"} + (where t (t:find "^upp%s")) {: title :icon " " :color "#7EBAE4"} + (where t (t:find "^nrsw%s")) {: title :icon " " :color "#7EBAE4"} + (where t (t:find :^instagram-)) {: title :icon " " :color "#FB2179"} + _ {: title :icon " " :color "#F8F8F2"})) + + (wezterm.on :format-tab-title + (fn [tab tabs panes config hover max-width] + (let [tab-info (extract-tab-info tab.active_pane.title) + title (wezterm.truncate_right tab-info.title + (- max-width 5))] + (if tab.is_active + [; Left + {:Background {:Color colors.active-background}} + {:Foreground {:Color colors.active-indicator}} + {:Text "┃ "} + ; Center + {:Foreground {:Color tab-info.color}} + {:Text tab-info.icon} + {:Foreground {:Color colors.active-foreground}} + {:Attribute {:Intensity :Bold}} + {:Attribute {:Italic true}} + {:Text title} + ; Right + {:Attribute {:Intensity :Normal}} + {:Attribute {:Italic false}} + {:Text " "}] + [; Left + {:Background {:Color colors.inactive-background}} + {:Foreground {:Color colors.inactive-foreground}} + {:Text " "} + ; Center + {:Foreground {:Color tab-info.color}} + {:Text tab-info.icon} + {:Foreground {:Color colors.inactive-foreground}} + {:Text title} + ; Right + {:Text " "}])))) + ;; Configuration {:default_prog [_G.shells.fish :--interactive] ;; Appearance :color_scheme "Dracula (Official)" @@ -8,10 +58,15 @@ :right window-padding :top window-padding :bottom window-padding} + ;; Tabs :enable_tab_bar true - :use_fancy_tab_bar true + :use_fancy_tab_bar false :hide_tab_bar_if_only_one_tab true :tab_bar_at_bottom true + :tab_max_width 48 + :colors {:tab_bar {:background colors.inactive-background + :new_tab {:bg_color colors.inactive-background + :fg_color colors.inactive-foreground}}} ;; Fonts :font (wezterm.font_with_fallback [{:family "JetBrains Mono" :weight :Medium}