From a7bcc9258627391dd051f5ea903cca749d581f20 Mon Sep 17 00:00:00 2001 From: rootiest Date: Tue, 24 Sep 2024 14:40:11 -0400 Subject: [PATCH] style: enhance tab bar with new separators and themes --- config/colors.lua | 88 +++------------------ config/font.lua | 56 ++------------ config/keys.lua | 168 ++++++++++++++++++++++++++++++++++------- config/window.lua | 9 ++- funcs.lua | 124 ++++++++++++++++++++++++++++++ plugins/hyperlinks.lua | 6 +- plugins/resurrect.lua | 2 +- plugins/tabline.lua | 147 ++++++++++++++++++++++++++++++++++++ plugins/wezbar.lua | 44 ----------- types.lua | 87 +++++++++++++++++++++ wezterm.lua | 6 ++ 11 files changed, 531 insertions(+), 206 deletions(-) create mode 100644 funcs.lua create mode 100644 plugins/tabline.lua delete mode 100644 plugins/wezbar.lua create mode 100644 types.lua diff --git a/config/colors.lua b/config/colors.lua index bd0a067..c46b1e1 100644 --- a/config/colors.lua +++ b/config/colors.lua @@ -4,53 +4,15 @@ local cur_hour = WEZTERM.time.now():format("%H") -local function get_hour_angle(hour) - return (hour / 12) * 360 -end - -local hour_angle = get_hour_angle(cur_hour) +local hour_angle = require("funcs").get_hour_angle(cur_hour) return { -- Color Scheme - color_scheme = "Catppuccin Macchiato", + color_scheme = "Catppuccin Mocha", -- Tab Bar Colors colors = { - tab_bar = { - background = "#1a1b26", - inactive_tab_edge = "#484D69", - active_tab = { - bg_color = "#CA9EE6", - fg_color = "#232634", - intensity = "Normal", - underline = "None", - italic = false, - strikethrough = false, - }, - inactive_tab = { - bg_color = "#484D69", - fg_color = "#C6D0F5", - }, - inactive_tab_hover = { - bg_color = "#3b3052", - fg_color = "#C6D0F5", - italic = true, - intensity = "Bold", - }, - new_tab = { - bg_color = "#1a1b26", - fg_color = "#C6D0F5", - intensity = "Bold", - underline = "None", - italic = false, - strikethrough = false, - }, - new_tab_hover = { - bg_color = "#CA9EE6", - fg_color = "#232634", - italic = true, - intensity = "Bold", - }, - }, + -- Compose Cursor + compose_cursor = "#a5e3a0", -- Visual Bell visual_bell = "#E78284", }, @@ -78,47 +40,15 @@ return { angle = hour_angle, }, }, - - -- Specifies the set of colors that are interpolated in the gradient. - -- Accepts CSS style color specs, from named colors, through rgb - -- strings and more colors = { -- "#303446", "#24273a", "#1e1e2e", }, - - -- Instead of specifying `colors`, you can use one of a number of - -- predefined, preset gradients. - -- A list of presets is shown in a section below. - -- preset = "Warm", - - -- Specifies the interpolation style to be used. - -- "Linear", "Basis" and "CatmullRom" as supported. - -- The default is "Linear". - interpolation = "Linear", - - -- How the colors are blended in the gradient. - -- "Rgb", "LinearRgb", "Hsv" and "Oklab" are supported. - -- The default is "Rgb". - blend = "Rgb", - - -- To avoid vertical color banding for horizontal gradients, the - -- gradient position is randomly shifted by up to the `noise` value - -- for each pixel. - -- Smaller values, or 0, will make bands more prominent. - -- The default value is 64 which gives decent looking results - -- on a retina macbook pro display. - -- noise = 64, - - -- By default, the gradient smoothly transitions between the colors. - -- You can adjust the sharpness by specifying the segment_size and - -- segment_smoothness parameters. - -- segment_size configures how many segments are present. - -- segment_smoothness is how hard the edge is; 0.0 is a hard edge, - -- 1.0 is a soft edge. - - -- segment_size = 11, - -- segment_smoothness = 0.0, + interpolation = "CatmullRom", + blend = "Oklab", + noise = 128, + segment_size = 7, + segment_smoothness = 1.0, }, } diff --git a/config/font.lua b/config/font.lua index 8e29221..53f1403 100644 --- a/config/font.lua +++ b/config/font.lua @@ -2,64 +2,22 @@ -- │ FONTS │ -- ╰─────────────────────────────────────────────────────────╯ +local types = require("types") + return { -- Terminal Font Size - font_size = 11.5, + font_size = 12.0, -- Terminal Font - font = WEZTERM.font_with_fallback({ - { - -- Font Family - family = "Iosevka Term", - -- Font Weight - weight = "Medium", - -- Character Varients and Ligatures - harfbuzz_features = { - "VSAH=7", - "VSAF=3", - "VSAI=3", - "VSAJ=8", - "VSAM=4", - "VLAB=5", - "cv10=7", - "cv41=3", - "cv44=6", - "cv07=4", - }, - }, - "Symbols Nerd Font", - "Symbols Nerd Font Mono", - "VictorMono Nerd Font", - "Hack", - "MonaspaceKrypton Nerd Font", - "Roboto", - "Cascadia Code", - }), + font = WEZTERM.font_with_fallback(types.font), -- Tab Font window_frame = { - font = WEZTERM.font({ - -- Tab Font Family - family = "Iosevka", - -- Tab Font Weight - weight = "Medium", - -- Character Varients and Ligatures - harfbuzz_features = { - "VSAH=7", - "VSAF=3", - "VSAI=3", - "VSAJ=8", - "VSAM=4", - "VLAB=5", - "cv10=7", - "cv41=3", - "cv44=6", - "cv07=4", - }, - }), + font = WEZTERM.font(types.win_font), -- Tab Font Size font_size = 10, }, - -- Cell Width + -- Cell Sizing cell_width = 1.0, + line_height = 1.0, -- ANSI Colors bold_brightens_ansi_colors = "BrightAndBold", -- FreeType Load Flags diff --git a/config/keys.lua b/config/keys.lua index b976123..1c022d4 100644 --- a/config/keys.lua +++ b/config/keys.lua @@ -2,14 +2,16 @@ -- │ KEYS │ -- ╰─────────────────────────────────────────────────────────╯ --- Define action class +-- Define objects local act = WEZTERM.action return { - -- Leader key + -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Leader key ━━━━━━━━━━━━━━━━━━━━━━━━━━ leader = { key = " ", mods = "CTRL", timeout_milliseconds = 1500 }, - + -- ━━━━━━━━━━━━━━━━━━━━━━━━━ Global Key Mappings ━━━━━━━━━━━━━━━━━━━━━ keys = { + -- Close window + { key = "q", mods = "LEADER|SHIFT|CTRL", action = act.QuitApplication }, -- Split pane { key = "|", mods = "LEADER|SHIFT", action = act.SplitHorizontal({ domain = "CurrentPaneDomain" }) }, { key = "_", mods = "LEADER|SHIFT", action = act.SplitVertical({ domain = "CurrentPaneDomain" }) }, @@ -19,12 +21,39 @@ return { { key = "j", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection("Down") }, { key = "k", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection("Up") }, { key = "l", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection("Right") }, + -- Move pane to new window + { + key = "!", + mods = "LEADER | SHIFT", + action = WEZTERM.action_callback(function(_, pane) + pane:move_to_new_window() + end), + }, + + -- Toggle pane zoom + { + key = "z", + mods = "SHIFT|CTRL", + action = act.TogglePaneZoomState, + }, + { + key = "z", + mods = "LEADER", + action = act.TogglePaneZoomState, + }, + + -- Close pane + { key = "q", mods = "LEADER", action = act.CloseCurrentPane({ confirm = true }) }, + { key = "q", mods = "SHIFT|CTRL", action = act.CloseCurrentPane({ confirm = true }) }, -- Resize pane { key = "h", mods = "ALT", action = act.AdjustPaneSize({ "Left", 1 }) }, { key = "j", mods = "ALT", action = act.AdjustPaneSize({ "Down", 1 }) }, { key = "k", mods = "ALT", action = act.AdjustPaneSize({ "Up", 1 }) }, { key = "l", mods = "ALT", action = act.AdjustPaneSize({ "Right", 1 }) }, + -- Resize pane mode + { key = "r", mods = "LEADER", action = act.ActivateKeyTable({ name = "resize_mode", one_shot = false }) }, + { key = "p", mods = "LEADER", action = act.ActivateKeyTable({ name = "window_mode", one_shot = false }) }, -- Tab Manipulation { key = "PageUp", mods = "CTRL", action = act.ActivateTabRelative(1) }, @@ -32,14 +61,7 @@ return { { key = "PageDown", mods = "CTRL", action = act.ActivateTabRelative(-1) }, { key = "PageDown", mods = "SHIFT|CTRL", action = act.MoveTabRelative(-1) }, - -- Miscellaneous - { key = "a", mods = "LEADER|CTRL", action = act.SendKey({ key = "a", mods = "CTRL" }) }, - { key = ";", mods = "CTRL", action = act.ActivateCommandPalette }, - { key = "F1", mods = "LEADER", action = act.ShowDebugOverlay }, - { key = "s", mods = "LEADER|CTRL", action = act.ShowLauncherArgs({ flags = "DOMAINS" }) }, - { key = "z", mods = "LEADER|CTRL", action = act.TogglePaneZoomState }, - { key = "n", mods = "LEADER|CTRL", action = act.SpawnWindow }, - { + { -- Quick launch key = "x", mods = "LEADER|CTRL", action = act.ShowLauncherArgs({ @@ -48,6 +70,28 @@ return { }), }, + -- Search + { key = "f", mods = "LEADER", action = act.Search("CurrentSelectionOrEmptyString") }, + { key = "f", mods = "SHIFT|CTRL", action = act.Search("CurrentSelectionOrEmptyString") }, + + -- Miscellaneous + { key = "a", mods = "LEADER|CTRL", action = act.SendKey({ key = "a", mods = "CTRL" }) }, + { key = ";", mods = "CTRL", action = act.ActivateCommandPalette }, + { key = "F1", mods = "LEADER", action = act.ShowDebugOverlay }, + { + key = "u", + mods = "LEADER|CTRL", + action = act.AttachDomain("SSH:aws-discord"), + }, + { + key = "s", + mods = "LEADER|CTRL", + action = act.ShowLauncherArgs({ title = "Connect to SSH server", flags = "FUZZY|DOMAINS" }), + }, + { key = "z", mods = "LEADER|CTRL", action = act.TogglePaneZoomState }, + { key = "n", mods = "LEADER|CTRL", action = act.SpawnWindow }, + { key = "x", mods = "LEADER", action = act.ActivateCopyMode }, + -- Naming { -- Rename [W]orkspace key = "w", @@ -66,9 +110,10 @@ return { mods = "LEADER|CTRL", action = act.PromptInputLine({ description = "Enter new name for the tab:", - action = WEZTERM.action_callback(function(window, _, line) + action = WEZTERM.action_callback(function(_, pane, line) if line then - WEZTERM.mux.rename_workspace(window:active_workspace(), line) + local tab = pane:tab() + tab:set_title(line) end end), }), @@ -79,33 +124,100 @@ return { action = act.Multiple({ WEZTERM.action_callback(function(_, _) RESURRECT.save_state(RESURRECT.workspace_state.get_workspace_state()) + RESURRECT.window_state.save_window_action() end), }), }, { -- [R]estore Session key = "r", mods = "ALT", - action = act.Multiple({ - WEZTERM.action_callback(function(win, pane) - RESURRECT.fuzzy_load(win, pane, function(id, _) - id = string.match(id, "([^/]+)$") - id = string.match(id, "(.+)%..+$") - local state = RESURRECT.load_state(id, "workspace") + action = WEZTERM.action_callback(function(win, pane) + RESURRECT.fuzzy_load(win, pane, function(id) + local type = string.match(id, "^([^/]+)") -- match before '/' + id = string.match(id, "([^/]+)$") -- match after '/' + id = string.match(id, "(.+)%..+$") -- remove file extension + local state + if type == "workspace" then + state = RESURRECT.load_state(id, "workspace") RESURRECT.workspace_state.restore_workspace(state, { relative = true, restore_text = true, on_pane_restore = RESURRECT.tab_state.default_on_pane_restore, }) - end) - end), - }), - }, - { - key = "!", - mods = "LEADER | SHIFT", - action = WEZTERM.action_callback(function(_, pane) - pane:move_to_new_window() + elseif type == "window" then + state = RESURRECT.load_state(id, "window") + RESURRECT.window_state.restore_window(pane:window(), state, { + relative = true, + restore_text = true, + on_pane_restore = RESURRECT.tab_state.default_on_pane_restore, + -- uncomment this line to use active tab when restoring + -- tab = win:active_tab(), + }) + end + end) end), }, }, + + -- ━━━━━━━━━━━━━━━━━━━━━━ Conditional Key Mappings ━━━━━━━━━━━━━━━━━━━ + key_tables = { + resize_mode = { ---------- Resize Pane Mode ------------------------- + { key = "LeftArrow", action = act.AdjustPaneSize({ "Left", 1 }) }, + { key = "h", action = act.AdjustPaneSize({ "Left", 1 }) }, + + { key = "RightArrow", action = act.AdjustPaneSize({ "Right", 1 }) }, + { key = "l", action = act.AdjustPaneSize({ "Right", 1 }) }, + + { key = "UpArrow", action = act.AdjustPaneSize({ "Up", 1 }) }, + { key = "k", action = act.AdjustPaneSize({ "Up", 1 }) }, + + { key = "DownArrow", action = act.AdjustPaneSize({ "Down", 1 }) }, + { key = "j", action = act.AdjustPaneSize({ "Down", 1 }) }, + + -- Cancel the mode by pressing escape + { key = "Escape", action = "PopKeyTable" }, + }, + window_mode = { --------- Activate Pane Mode ---------------------- + { key = "LeftArrow", action = act.ActivatePaneDirection("Left") }, + { key = "h", action = act.ActivatePaneDirection("Left") }, + + { key = "RightArrow", action = act.ActivatePaneDirection("Right") }, + { key = "l", action = act.ActivatePaneDirection("Right") }, + + { key = "UpArrow", action = act.ActivatePaneDirection("Up") }, + { key = "k", action = act.ActivatePaneDirection("Up") }, + + { key = "DownArrow", action = act.ActivatePaneDirection("Down") }, + { key = "j", action = act.ActivatePaneDirection("Down") }, + }, + }, + + -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━ Mouse Bindings ━━━━━━━━━━━━━━━━━━━━━━━━ + mouse_bindings = { + { -- Left-Click: (Up) Select Text + event = { Up = { streak = 1, button = "Left" } }, + mods = "NONE", + action = act.CompleteSelection("ClipboardAndPrimarySelection"), + }, + { -- Ctrl+Left-Click: (Up) Open Hyperlink + event = { Up = { streak = 1, button = "Left" } }, + mods = "CTRL", + action = act.OpenLinkAtMouseCursor, + }, + -- { -- Ctrl+Double-Left-Click: (Up) Open Hyperlink + -- event = { Up = { streak = 2, button = "Left" } }, + -- mods = "CTRL", + -- action = act.OpenLinkAtMouseCursor, + -- }, + { -- Ctrl+WheelUp: Go to previous tab + event = { Down = { streak = 1, button = { WheelUp = 1 } } }, + mods = "CTRL", + action = act.ActivateTabRelative(-1), + }, + { -- Ctrl+WheelDown: Go to next tab + event = { Down = { streak = 1, button = { WheelDown = 1 } } }, + mods = "CTRL", + action = act.ActivateTabRelative(1), + }, + }, } diff --git a/config/window.lua b/config/window.lua index cdaa4b0..0ce270a 100644 --- a/config/window.lua +++ b/config/window.lua @@ -10,6 +10,9 @@ return { initial_rows = 38, tab_max_width = 60, + tab_bar_at_bottom = false, + + unicode_version = 14, -- Resize by cell use_resize_increments = true, @@ -17,9 +20,6 @@ return { -- Use Retro tab bar use_fancy_tab_bar = false, - -- Prefer to spawn tabs rather than windows - prefer_to_spawn_tabs = true, - -- Set the window padding window_padding = { left = "0%", @@ -47,6 +47,9 @@ return { -- Terminal Variable term = "wezterm", + --Honor kitty protocol inputs + enable_kitty_keyboard = true, + -- Rendering front_end = "WebGpu", webgpu_power_preference = "HighPerformance", diff --git a/funcs.lua b/funcs.lua new file mode 100644 index 0000000..5c59ebd --- /dev/null +++ b/funcs.lua @@ -0,0 +1,124 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ FUNCS │ +-- ╰─────────────────────────────────────────────────────────╯ + +local M = {} + +local wezterm = WEZTERM +local types = require("types") + +-- Set the leader icon +wezterm.on("update-status", function(window, _) + if window:leader_is_active() then + types.leader.icon = types.leader.on + else + types.leader.icon = types.leader.off + end +end) + +---@function Function to render the leader icon +---@return string leadericon The leader icon +function M.leader_component() + local prefix = types.leader.padding.left or types.leader.prefix or " " + local suffix = types.leader.padding.right or types.leader.suffix or "" + local leaderstr = prefix .. types.leader.icon .. suffix + return leaderstr +end + +---@function Function to convert a number to its ordinal string representation +---@param n string The number to convert +---@return string The ordinal string representation +function M.ordinal(n) + local suffixes = { "th", "st", "nd", "rd" } + local mod100 = n % 100 + return n .. (suffixes[(mod100 - 20) % 10 + 1] or suffixes[1]) +end + +---@function Function to format the tab title +---@param title string The original tab title +---@return string new_string Formatted string +function M.format_tab_title(title) + if title ~= "default" then + return title .. wezterm.nerdfonts.ple_right_half_circle_thin + else + return "" + end +end + +---@function Function to format the tab title +---@param title string The original tab title +---@return string new_string Formatted string +function M.format_inactive_tab_title(title) + if title ~= "default" then + return title .. " " + else + return "" + end +end + +---@function Function to convert an hour to an angle +---@param hour string The hour to convert +---@return number The angle in degrees +function M.get_hour_angle(hour) + return (hour / 12) * 360 +end + +-- Function to convert a hex color to its opposite brightness +function M.invert_color_brightness(hex_color) + -- Validate the input hex_color format + if not hex_color:match("^#%x%x%x%x%x%x$") then + error("Invalid hex color format. Use #RRGGBB.") + end + + -- Remove the hash (#) from the hex color + local r = tonumber(hex_color:sub(2, 3), 16) -- Red component + local g = tonumber(hex_color:sub(4, 5), 16) -- Green component + local b = tonumber(hex_color:sub(6, 7), 16) -- Blue component + + -- Check for valid RGB values before proceeding + if not (r and g and b and r >= 0 and r <= 255 and g >= 0 and g <= 255 and b >= 0 and b <= 255) then + error("Invalid RGB values extracted from hex color.") + end + + -- Calculate the brightness of the color using perceived brightness formula + local brightness = (r * 0.299 + g * 0.587 + b * 0.114) + + -- Invert the color based on brightness + if brightness < 128 then + -- If the color is dark, make it lighter + r = math.min(r + (255 - r) * 0.33, 255) + g = math.min(g + (255 - g) * 0.33, 255) + b = math.min(b + (255 - b) * 0.33, 255) + else + -- If the color is light, make it darker + r = math.max(r - r * 0.66, 0) + g = math.max(g - g * 0.66, 0) + b = math.max(b - b * 0.66, 0) + end + + -- Convert back to hex format, ensuring components are integers + return string.format("#%02x%02x%02x", math.floor(r + 0.5), math.floor(g + 0.5), math.floor(b + 0.5)) +end + +-- Function to get the complementary color of a given hex color +function M.complementary_color(hex_color) + -- Validate the input hex_color format + if not hex_color:match("^#%x%x%x%x%x%x$") then + error("Invalid hex color format. Use #RRGGBB.") + end + + -- Remove the hash (#) from the hex color and extract RGB components + local r = tonumber(hex_color:sub(2, 3), 16) -- Red component + local g = tonumber(hex_color:sub(4, 5), 16) -- Green component + local b = tonumber(hex_color:sub(6, 7), 16) -- Blue component + + -- Calculate the complementary color by inverting the RGB components + local complementary_r = 255 - r + local complementary_g = 255 - g + local complementary_b = 255 - b + + -- Convert the inverted RGB values back to hex format + return string.format("#%02x%02x%02x", complementary_r, complementary_g, complementary_b) +end + +return M diff --git a/plugins/hyperlinks.lua b/plugins/hyperlinks.lua index b8f9f70..9212234 100644 --- a/plugins/hyperlinks.lua +++ b/plugins/hyperlinks.lua @@ -8,9 +8,11 @@ local M = {} CONFIG.hyperlink_rules = WEZTERM.default_hyperlink_rules() -- Add support for GitHub link style + table.insert(CONFIG.hyperlink_rules, { - regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]], - format = "https://www.github.com/$1/$3", + regex = [["([a-zA-Z0-9_\-]+/[a-zA-Z0-9_\-\.]+)"]], + format = "https://www.github.com/$1", + highlight = 1, }) -- make Jira IDs clickable diff --git a/plugins/resurrect.lua b/plugins/resurrect.lua index 1df419f..d98996b 100644 --- a/plugins/resurrect.lua +++ b/plugins/resurrect.lua @@ -8,7 +8,7 @@ local M = {} RESURRECT = WEZTERM.plugin.require("https://github.com/MLFlexer/resurrect.wezterm") -- Set the periodic save interval -RESURRECT.periodic_save(60) +RESURRECT.periodic_save({ interval_seconds = 60, save_workspaces = true, save_windows = true }) -- load the state whenever I create a new workspace WEZTERM.on("smart_workspace_switcher.workspace_switcher.created", function(window, _, label) diff --git a/plugins/tabline.lua b/plugins/tabline.lua new file mode 100644 index 0000000..42c3d7b --- /dev/null +++ b/plugins/tabline.lua @@ -0,0 +1,147 @@ +local wezterm = WEZTERM +local config = CONFIG +local types = require("types") +local funcs = require("funcs") + +local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") + +tabline.setup({ + options = { + icons_enabled = true, + theme = "Catppuccin Mocha", + section_separators = { + left = wezterm.nerdfonts.ple_right_half_circle_thick, + right = wezterm.nerdfonts.ple_left_half_circle_thick, + }, + component_separators = { + left = wezterm.nerdfonts.ple_right_half_circle_thin, + right = wezterm.nerdfonts.ple_left_half_circle_thin, + }, + tab_separators = { + left = wezterm.nerdfonts.ple_right_half_circle_thick, + right = wezterm.nerdfonts.ple_left_half_circle_thick, + }, + }, + sections = { + tabline_a = { + funcs.leader_component, + { "mode", padding = { left = 1, right = 0 } }, + }, + tabline_b = { { "workspace", padding = { left = 1, right = 0 } } }, + tabline_c = { " " }, + tab_active = { + { + "zoomed", + icon = wezterm.nerdfonts.oct_zoom_in, + padding = { left = 0, right = 0 }, + }, + { + "index", + fmt = function(n, _) + return funcs.ordinal(n) + end, + padding = { left = 0, right = 0 }, + }, + wezterm.nerdfonts.ple_right_half_circle_thin, + { + "tab", + fmt = function(str) + return funcs.format_tab_title(str) + end, + padding = { left = 0, right = 0 }, + icons_enabled = false, + }, + { "parent", padding = { left = 0, right = 0 } }, + "/", + { "cwd", padding = { left = 0, right = 1 } }, + wezterm.nerdfonts.ple_left_half_circle_thin, + { "process", padding = { left = 0, right = 0 } }, + }, + tab_inactive = { + { + "zoomed", + icon = wezterm.nerdfonts.oct_zoom_in, + padding = { left = 0, right = 0 }, + }, + { + "index", + fmt = function(n, _) + return funcs.ordinal(n) + end, + padding = { left = 0, right = 0 }, + }, + ":", + { + "tab", + fmt = function(str) + return funcs.format_inactive_tab_title(str) + end, + padding = { left = 1, right = 0 }, + icons_enabled = false, + }, + { "parent", padding = { left = 0, right = 0 } }, + "/", + { "cwd", padding = { left = 0, right = 1 } }, + { "process", icons_only = true, padding = { left = 0, right = 0 } }, + }, + tabline_x = {}, + tabline_y = { + { + "datetime", + icons_only = false, + hour_to_icon = types.hours_icons, + padding = { left = 0, right = 1 }, + style = "%a %R", + }, + }, + tabline_z = { + { "hostname", padding = { left = 0, right = 1 } }, + { + "battery", + battery_to_icon = { + empty = { + wezterm.nerdfonts.fa_battery_empty .. " ", + color = { fg = funcs.invert_color_brightness("#f37ca0") }, + }, + quarter = { + wezterm.nerdfonts.fa_battery_quarter .. " ", + color = { fg = funcs.invert_color_brightness("#ffb080") }, + }, + half = { + wezterm.nerdfonts.fa_battery_half .. " ", + color = { fg = funcs.invert_color_brightness("#fbe2a9") }, + }, + three_quarters = wezterm.nerdfonts.fa_battery_three_quarters .. " ", + full = { + wezterm.nerdfonts.fa_battery_full .. " ", + color = { fg = funcs.invert_color_brightness("#93e398") }, + }, + }, + padding = { left = 0, right = 1 }, + }, + }, + }, + extensions = { "resurrect" }, +}) + +local function apply_tabline_config(conf) + conf.use_fancy_tab_bar = false + conf.show_new_tab_button_in_tab_bar = false + conf.tab_max_width = 64 + conf.window_padding = { + left = 0, + right = 0, + top = 0, + bottom = 0, + } + local normbg = require("tabline.config").colors.normal_mode.c.bg + conf.colors = { + tab_bar = { + background = normbg, + inactive_tab_edge = normbg, + }, + } + config.status_update_interval = 500 +end + +apply_tabline_config(config) diff --git a/plugins/wezbar.lua b/plugins/wezbar.lua deleted file mode 100644 index c003970..0000000 --- a/plugins/wezbar.lua +++ /dev/null @@ -1,44 +0,0 @@ --- ╭─────────────────────────────────────────────────────────╮ --- │ WEZBAR │ --- ╰─────────────────────────────────────────────────────────╯ - -local M = {} - --- Load Wezbar plugin -WEZBAR = WEZTERM.plugin.require("https://github.com/nekowinston/wezterm-bar") - --- Configure wezbar -WEZBAR.apply_to_config(CONFIG, { - position = "top", - max_width = 32, - dividers = "arrows", -- or "slant_left", "arrows", "rounded", false - indicator = { - leader = { - enabled = true, - off = " ", - on = " ", - }, - mode = { - enabled = true, - names = { - resize_mode = "RESIZE", - copy_mode = "VISUAL", - search_mode = "SEARCH", - }, - }, - }, - tabs = { - numerals = "arabic", -- or "roman" - pane_count = "superscript", -- or "subscript", false - brackets = { - active = { "", ":" }, - inactive = { "", ":" }, - }, - }, - clock = { -- note that this overrides the whole set_right_status - enabled = true, - format = "%a %R ", -- use https://wezfurlong.org/wezterm/config/lua/wezterm.time/Time/format.html - }, -}) - -return M diff --git a/types.lua b/types.lua new file mode 100644 index 0000000..fa07809 --- /dev/null +++ b/types.lua @@ -0,0 +1,87 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ TYPES │ +-- ╰─────────────────────────────────────────────────────────╯ + +local M = {} + +local wezterm = WEZTERM + +M.harfbuzz_features = { + "VSAH=7", + "VSAF=3", + "VSAI=3", + "VSAJ=8", + "VSAM=4", + "VLAB=5", + "cv10=7", + "cv41=3", + "cv44=6", + "cv07=4", +} + +M.hours_icons = { + ["00"] = wezterm.nerdfonts.md_clock_time_twelve_outline, + ["01"] = wezterm.nerdfonts.md_clock_time_one_outline, + ["02"] = wezterm.nerdfonts.md_clock_time_two_outline, + ["03"] = wezterm.nerdfonts.md_clock_time_three_outline, + ["04"] = wezterm.nerdfonts.md_clock_time_four_outline, + ["05"] = wezterm.nerdfonts.md_clock_time_five_outline, + ["06"] = wezterm.nerdfonts.md_clock_time_six_outline, + ["07"] = wezterm.nerdfonts.md_clock_time_seven_outline, + ["08"] = wezterm.nerdfonts.md_clock_time_eight_outline, + ["09"] = wezterm.nerdfonts.md_clock_time_nine_outline, + ["10"] = wezterm.nerdfonts.md_clock_time_ten_outline, + ["11"] = wezterm.nerdfonts.md_clock_time_eleven_outline, + ["12"] = wezterm.nerdfonts.md_clock_time_twelve, -- 12:00 in solid icon + ["13"] = wezterm.nerdfonts.md_clock_time_one, -- 1:00 in solid icon + ["14"] = wezterm.nerdfonts.md_clock_time_two, -- 2:00 in solid icon + ["15"] = wezterm.nerdfonts.md_clock_time_three, -- 3:00 in solid icon + ["16"] = wezterm.nerdfonts.md_clock_time_four, -- 4:00 in solid icon + ["17"] = wezterm.nerdfonts.md_clock_time_five, -- 5:00 in solid icon + ["18"] = wezterm.nerdfonts.md_clock_time_six, -- 6:00 in solid icon + ["19"] = wezterm.nerdfonts.md_clock_time_seven, -- 7:00 in solid icon + ["20"] = wezterm.nerdfonts.md_clock_time_eight, -- 8:00 in solid icon + ["21"] = wezterm.nerdfonts.md_clock_time_nine, -- 9:00 in solid icon + ["22"] = wezterm.nerdfonts.md_clock_time_ten, -- 10:00 in solid icon + ["23"] = wezterm.nerdfonts.md_clock_time_eleven, -- 11:00 in solid icon +} + +M.font = { + { + -- Font Family + family = "Iosevka Term", + -- Font WeightLazy + weight = "Medium", + -- Character Varients and Ligatures + harfbuzz_features = M.harfbuzz_features, + }, + "Flog Symbols", + "Symbols Nerd Font", + "Symbols Nerd Font Mono", + "VictorMono Nerd Font", + "Hack", + "MonaspaceKrypton Nerd Font", + "Roboto", + "Cascadia Code", +} + +M.win_font = { + -- Tab Font Family + family = "Iosevka", + -- Tab Font Weight + weight = "Medium", + -- Character Varients and Ligatures + harfbuzz_features = M.harfbuzz_features, +} + +M.leader = { + icon = "❯", + on = "❮", + off = "❯", + padding = { + left = " ", + right = "", + }, +} + +return M diff --git a/wezterm.lua b/wezterm.lua index 0022977..577a9cd 100644 --- a/wezterm.lua +++ b/wezterm.lua @@ -21,5 +21,11 @@ require("options").setup() -- Load Plugins require("plugins").setup() +--------- Update Plugins ---------- +---Running this may cause slowdowns +----------------------------------- +--- WEZTERM.plugin.update_all() --- +----------------------------------- + -- Return configuration return CONFIG