### Complete tabline configuration example Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt A comprehensive example demonstrating theme overrides, custom git status components, section layouts, and plugin extensions. ```lua local wezterm = require('wezterm') local config = wezterm.config_builder() local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") -- Custom component to show git status local function git_status(window) local pane = window:active_pane() local cwd = pane:get_current_working_dir() if cwd then local success, stdout = wezterm.run_child_process({ 'git', '-C', cwd.file_path, 'status', '--porcelain' }) if success and stdout ~= '' then return wezterm.nerdfonts.oct_git_compare .. ' ' end end return '' end 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, }, theme_overrides = { tab = { active = { fg = '#89dceb', bg = '#313244' }, }, }, }, sections = { tabline_a = { { 'mode', fmt = function(s) return s:sub(1,1) end } }, tabline_b = { 'workspace' }, tabline_c = { git_status }, tab_active = { { 'index', zero_indexed = false }, { 'parent', padding = 0, max_length = 8 }, '/', { 'cwd', padding = { left = 0, right = 1 }, max_length = 12 }, { 'zoomed', padding = 0 }, }, tab_inactive = { 'index', { 'process', padding = { left = 0, right = 1 } }, }, tabline_x = { { 'ram', throttle = 5 }, { 'cpu', throttle = 5 }, }, tabline_y = { { 'datetime', style = '%H:%M' }, 'battery', }, tabline_z = { 'hostname' }, }, extensions = { 'resurrect', 'smart_workspace_switcher' }, }) tabline.apply_to_config(config) return config ``` -------------------------------- ### Install and Configure tabline.wez Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Demonstrates how to require the plugin, apply default configurations, and integrate recommended settings into the WezTerm configuration. ```lua local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ options = { icons_enabled = true, theme = 'Catppuccin Mocha', tabs_enabled = true, theme_overrides = {}, section_separators = { left = wezterm.nerdfonts.pl_left_hard_divider, right = wezterm.nerdfonts.pl_right_hard_divider, }, component_separators = { left = wezterm.nerdfonts.pl_left_soft_divider, right = wezterm.nerdfonts.pl_right_soft_divider, }, tab_separators = { left = wezterm.nerdfonts.pl_left_hard_divider, right = wezterm.nerdfonts.pl_right_hard_divider, }, }, sections = { tabline_a = { 'mode' }, tabline_b = { 'workspace' }, tabline_c = { ' ' }, tab_active = { 'index', { 'parent', padding = 0 }, '/', { 'cwd', padding = { left = 0, right = 1 } }, { 'zoomed', padding = 0 }, }, tab_inactive = { 'index', { 'process', padding = { left = 0, right = 1 } } }, tabline_x = { 'ram', 'cpu' }, tabline_y = { 'datetime', 'battery' }, tabline_z = { 'domain' }, }, extensions = {}, }) tabline.apply_to_config(config) ``` -------------------------------- ### Install tabline.wez Plugin in WezTerm Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt This code snippet demonstrates how to install the tabline.wez plugin using WezTerm's plugin API. It requires the plugin from GitHub and then initializes it with default settings. ```lua local wezterm = require('wezterm') local config = wezterm.config_builder() -- Install tabline.wez plugin local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") -- Initialize with setup tabline.setup() -- Apply recommended WezTerm settings tabline.apply_to_config(config) return config ``` -------------------------------- ### Set WezTerm Tabline Theme After Setup Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Allows changing the tabline theme dynamically after the initial setup. This can be done by specifying just the theme name, the theme name with overrides, or only new overrides to apply to the current theme. ```lua tabline.set_theme('GruvboxDark') -- Just change theme ``` ```lua -- or tabline.set_theme('GruvboxDark', { -- Change theme with overrides normal_mode = { a = { fg = '#000000', bg = '#ffffff' } } }) ``` ```lua -- or tabline.set_theme({ -- Just apply new overrides to current theme normal_mode = { a = { fg = '#000000', bg = '#ffffff' } } }) ``` -------------------------------- ### Configure tabline.wez with Custom Options and Sections Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt This example shows how to initialize tabline.wez with custom configuration options, including enabling icons, setting a theme, defining separators, and configuring different sections like 'mode', 'workspace', 'index', and 'datetime'. ```lua local wezterm = require('wezterm') local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ options = { icons_enabled = true, theme = 'Catppuccin Mocha', tabs_enabled = true, section_separators = { left = wezterm.nerdfonts.pl_left_hard_divider, right = wezterm.nerdfonts.pl_right_hard_divider, }, component_separators = { left = wezterm.nerdfonts.pl_left_soft_divider, right = wezterm.nerdfonts.pl_right_soft_divider, }, tab_separators = { left = wezterm.nerdfonts.pl_left_hard_divider, right = wezterm.nerdfonts.pl_right_hard_divider, }, }, sections = { tabline_a = { 'mode' }, tabline_b = { 'workspace' }, tabline_c = { ' ' }, tab_active = { 'index', { 'parent', padding = 0 }, '/', { 'cwd', padding = { left = 0, right = 1 } }, { 'zoomed', padding = 0 }, }, tab_inactive = { 'index', { 'process', padding = { left = 0, right = 1 } } }, tabline_x = { 'ram', 'cpu' }, tabline_y = { 'datetime', 'battery' }, tabline_z = { 'domain' }, }, extensions = {}, }) ``` -------------------------------- ### Configure Tabline Options with Local and Global Formatters Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md This example shows how to configure tabline options, including global formatters and local overrides. The `fmt` option is used globally to convert text to lowercase, and locally for the 'mode' component to display only the first character. Global options set defaults that can be overridden by local options. ```lua tabline.setup { options = { fmt = string.lower }, sections = { tabline_a = { { 'mode', fmt = function(str) return str:sub(1,1) end } }, tabline_b = { 'window' } } } ``` -------------------------------- ### Configure Component Options and Formatting (Lua) Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Allows detailed configuration of individual tabline components, including enabling/disabling icons, setting padding, defining conditional display logic, and formatting the output text. This setup requires the wezterm and tabline.wez libraries. ```lua local wezterm = require('wezterm') local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ options = { icons_enabled = true, -- Global default for all components }, sections = { tabline_a = { { 'mode', icons_enabled = true, -- Enable/disable icon for this component icons_only = false, -- Show only icon, hide text icon = wezterm.nerdfonts.cod_terminal_tmux, -- Custom icon -- Or with color: icon = { wezterm.nerdfonts.cod_terminal_tmux, color = { fg = '#00ff00' } } -- Or right-aligned: icon = { wezterm.nerdfonts.cod_terminal_tmux, align = 'right' } padding = 1, -- Padding on both sides -- Or asymmetric: padding = { left = 2, right = 1 } cond = function(window) return true end, -- Conditional display fmt = function(str, window) -- Format the output return str:sub(1, 1) -- Show only first character end, }, }, tabline_y = { { 'datetime', style = '%Y-%m-%d %H:%M:%S', -- Custom date format }, }, tab_active = { { 'index', zero_indexed = false, -- Start tab numbering at 1 (default) or 0 }, { 'cwd', max_length = 10, -- Truncate long directory names }, }, } }) ``` -------------------------------- ### Get tabline.wez Theme Colors Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt This example shows how to retrieve the current theme colors used by tabline.wez, including mode-specific colors and tab colors. This is helpful for creating custom components that match the current theme. ```lua local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ options = { theme = 'Catppuccin Mocha' } }) -- Get theme colors for custom component styling local theme = tabline.get_theme() -- theme.normal_mode.a.fg -- foreground color for section A in normal mode -- theme.normal_mode.a.bg -- background color for section A in normal mode -- theme.tab.active.fg -- active tab foreground -- theme.tab.inactive.bg -- inactive tab background -- theme.colors -- full WezTerm color scheme object ``` -------------------------------- ### Define Custom Tabline Component with WezTerm Format Items Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md This example illustrates using WezTerm's FormatItems to define a custom tabline component with specific text styling, including underline, foreground, and background colors. The `ResetAttributes` format item is noted to reset all attributes to the component's default. ```lua sections = { tabline_c = { { Attribute = { Underline = 'Single' } }, { Foreground = { AnsiColor = 'Fuchsia' } }, { Background = { Color = 'blue' } }, 'Hello World' } } ``` -------------------------------- ### Change WezTerm Tabline Components Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Specifies the components to be displayed within the tabline sections. This example shows how to set the 'mode' component for the 'tabline_a' section. ```lua sections = { tabline_a = { 'mode' } } ``` -------------------------------- ### Configure Theme Overrides in tabline.wez Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Shows how to define custom colors for specific modes and tab states during the initial setup. This provides full control over the visual appearance of the status bar. ```lua local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ options = { theme = 'Catppuccin Mocha', theme_overrides = { normal_mode = { a = { fg = '#181825', bg = '#89b4fa' }, b = { fg = '#89b4fa', bg = '#313244' }, c = { fg = '#cdd6f4', bg = '#181825' }, }, copy_mode = { a = { fg = '#181825', bg = '#f9e2af' }, b = { fg = '#f9e2af', bg = '#313244' }, c = { fg = '#cdd6f4', bg = '#181825' }, }, search_mode = { a = { fg = '#181825', bg = '#a6e3a1' }, b = { fg = '#a6e3a1', bg = '#313244' }, c = { fg = '#cdd6f4', bg = '#181825' }, }, window_mode = { a = { fg = '#181825', bg = '#cba6f7' }, b = { fg = '#cba6f7', bg = '#313244' }, c = { fg = '#cdd6f4', bg = '#181825' }, }, tab = { active = { fg = '#89b4fa', bg = '#313244' }, inactive = { fg = '#cdd6f4', bg = '#181825' }, inactive_hover = { fg = '#f5c2e7', bg = '#313244' }, } } } }) ``` -------------------------------- ### Get Current WezTerm Tabline Theme Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Retrieves the current theme configuration, including overrides and the base WezTerm colors. This is useful for creating custom components or extensions that need to match the active theme. ```lua tabline.get_theme() ``` -------------------------------- ### Define Custom Tabline Component with Lua Expressions Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md This snippet demonstrates using arbitrary Lua expressions as tabline components, including oneliners, global variables, and require statements. The example shows the use of `os.date`, a global variable `data`, and a function from a `require`d module. ```lua sections = { tabline_c = { os.date('%a'), data, require('util').status() } } ``` -------------------------------- ### Configure system monitoring components Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Sets up CPU and RAM monitoring components with throttling to control update frequency. Includes an option to toggle PowerShell usage on Windows platforms. ```lua local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ sections = { tabline_x = { { 'ram', throttle = 3, -- Update every 3 seconds (0 disables throttling) }, { 'cpu', throttle = 3, -- Update every 3 seconds use_pwsh = false, -- Set true to use PowerShell on Windows }, }, } }) ``` -------------------------------- ### Configure Domain Icons for Tabline Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Maps different connection domains to specific icons for visual identification in the tabline. The `domain_to_icon` table allows customization for common domains like 'default', 'ssh', 'wsl', 'docker', and 'unix'. ```lua sections = { tabline_a = { { 'domain', domain_to_icon = { default = wezterm.nerdfonts.md_monitor, ssh = wezterm.nerdfonts.md_ssh, wsl = wezterm.nerdfonts.md_microsoft_windows, docker = wezterm.nerdfonts.md_docker, unix = wezterm.nerdfonts.cod_terminal_linux } } } } ``` -------------------------------- ### Load WezTerm Tabline Extensions Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Specifies which tabline extensions to load to modify the status line appearance. By default, no extensions are loaded for performance reasons. Extensions like 'resurrect', 'smart_workspace_switcher', 'quick_domains', and 'presentation' are available. ```lua extensions = { 'resurrect' } ``` -------------------------------- ### Configure general tabline component options Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Defines the global configuration structure for tabline components. Includes settings for icon display, conditional rendering, padding, and custom formatting functions. ```lua sections = { tabline_a = { { 'mode', icons_enabled = true, icons_only = false, icon = nil, cond = nil, padding = 1, fmt = nil } } } ``` -------------------------------- ### Configure Process Icons for Tabline Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Maps process names to specific icons and colors for display in the tabline. This allows for visual identification of running processes. The `process_to_icon` table is a key-value store where keys are process names and values are icon definitions. ```lua sections = { tab_active = { { 'process', process_to_icon = { ['air'] = { wezterm.nerdfonts.md_language_go, color = { fg = colors.brights[5] } }, ['bacon'] = { wezterm.nerdfonts.dev_rust, color = { fg = colors.ansi[2] } }, ['bat'] = { wezterm.nerdfonts.md_bat, color = { fg = colors.ansi[5] } }, ['btm'] = { wezterm.nerdfonts.md_chart_donut_variant, color = { fg = colors.ansi[2] } }, ['btop'] = { wezterm.nerdfonts.md_chart_areaspline, color = { fg = colors.ansi[2] } }, ['bun'] = { wezterm.nerdfonts.md_hamburger, color = { fg = colors.cursor_bg or nil } }, ['cargo'] = { wezterm.nerdfonts.dev_rust, color = { fg = colors.ansi[2] } }, ['cmd.exe'] = { wezterm.nerdfonts.md_console_line, color = { fg = colors.cursor_bg or nil } }, ['curl'] = wezterm.nerdfonts.md_flattr, ['debug'] = { wezterm.nerdfonts.cod_debug, color = { fg = colors.ansi[5] } }, ['default'] = wezterm.nerdfonts.md_application, ['docker'] = { wezterm.nerdfonts.md_docker, color = { fg = colors.ansi[5] } }, ['docker-compose'] = { wezterm.nerdfonts.md_docker, color = { fg = colors.ansi[5] } }, ['dpkg'] = { wezterm.nerdfonts.dev_debian, color = { fg = colors.ansi[2] } }, ['fish'] = { wezterm.nerdfonts.md_fish, color = { fg = colors.cursor_bg or nil } }, ['git'] = { wezterm.nerdfonts.dev_git, color = { fg = colors.brights[4] or nil } }, ['go'] = { wezterm.nerdfonts.md_language_go, color = { fg = colors.brights[5] } }, ['kubectl'] = { wezterm.nerdfonts.md_docker, color = { fg = colors.ansi[5] } }, ['kuberlr'] = { wezterm.nerdfonts.md_docker, color = { fg = colors.ansi[5] } }, ['lazygit'] = { wezterm.nerdfonts.cod_github, color = { fg = colors.brights[4] or nil } }, ['lua'] = { wezterm.nerdfonts.seti_lua, color = { fg = colors.ansi[5] } }, ['make'] = wezterm.nerdfonts.seti_makefile, ['nix'] = { wezterm.nerdfonts.linux_nixos, color = { fg = colors.ansi[5] } }, ['node'] = { wezterm.nerdfonts.md_nodejs, color = { fg = colors.brights[2] } }, ['npm'] = { wezterm.nerdfonts.md_npm, color = { fg = colors.brights[2] } }, ['nvim'] = { wezterm.nerdfonts.custom_neovim, color = { fg = colors.ansi[3] } } } } } } ``` -------------------------------- ### Utilize WezTerm Format Items as Tabline Components (Lua) Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Demonstrates how to use WezTerm's built-in format items directly as tabline components for advanced text styling, including attributes like underline, bold, and colors (foreground and background). This allows for rich, styled text within the tabline. Requires wezterm and tabline.wez. ```lua local wezterm = require('wezterm') local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ sections = { tabline_c = { { Attribute = { Underline = 'Single' } }, { Foreground = { AnsiColor = 'Fuchsia' } }, { Background = { Color = 'blue' } }, 'Styled Text', -- Strings are auto-wrapped in { Text = '...' } 'ResetAttributes', -- Reset to section default styling 'Normal Text', }, tabline_x = { { Foreground = { Color = '#ff6600' } }, { Attribute = { Intensity = 'Bold' } }, 'ALERT', 'ResetAttributes', }, } }) ``` -------------------------------- ### Enable Built-in Extensions Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Shows how to integrate existing WezTerm plugins like resurrect or smart_workspace_switcher into the tabline status display. ```lua local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ extensions = { 'resurrect', 'smart_workspace_switcher', 'quick_domains', 'presentation', } }) ``` -------------------------------- ### Configure cwd and index component options Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Sets specific behavior for path display and tab indexing. The cwd component supports length truncation, while the index component allows toggling between zero and one-based indexing. ```lua sections = { tab_active = { { 'cwd', max_length = 10 }, { 'index', zero_indexed = false } } } ``` -------------------------------- ### Customize domain icons Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Maps specific domain types like SSH, Docker, and WSL to custom Nerd Font icons within the tabline configuration. ```lua local wezterm = require('wezterm') local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ sections = { tabline_z = { { 'domain', domain_to_icon = { default = wezterm.nerdfonts.md_monitor, ssh = wezterm.nerdfonts.md_ssh, wsl = wezterm.nerdfonts.md_microsoft_windows, docker = wezterm.nerdfonts.md_docker, unix = wezterm.nerdfonts.cod_terminal_linux, }, }, }, } }) ``` -------------------------------- ### Customize Process Icons Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Configures the tabline to display specific Nerd Font icons based on the active process name, with support for custom foreground colors. ```lua local wezterm = require('wezterm') local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") local theme = tabline.get_theme() local colors = theme.colors tabline.setup({ sections = { tab_inactive = { 'index', { 'process', padding = { left = 0, right = 1 }, process_to_icon = { ['nvim'] = { wezterm.nerdfonts.custom_neovim, color = { fg = colors.ansi[3] } }, ['git'] = { wezterm.nerdfonts.dev_git, color = { fg = colors.brights[4] } }, ['default'] = wezterm.nerdfonts.md_application, }, }, }, } }) ``` -------------------------------- ### Configure datetime component with hourly icons Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Configures the datetime component to display time in a specific format and map specific hours to custom Nerd Font icons. Requires the datetime component type. ```lua sections = { tabline_a = { { 'datetime', style = '%H:%M', hour_to_icon = { ['00'] = wezterm.nerdfonts.md_clock_time_twelve_outline, ['01'] = wezterm.nerdfonts.md_clock_time_one_outline, ['02'] = wezterm.nerdfonts.md_clock_time_two_outline, ['23'] = wezterm.nerdfonts.md_clock_time_eleven } } } } ``` -------------------------------- ### Dynamically Update Themes in tabline.wez Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Demonstrates how to update the tabline theme at runtime using theme names or custom color overrides. This allows for conditional styling based on application state. ```lua local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup() -- Change theme by name tabline.set_theme('GruvboxDark') -- Change theme with custom overrides tabline.set_theme('Nord', { normal_mode = { a = { fg = '#000000', bg = '#ffffff' } } }) -- Apply overrides to current theme without changing base theme tabline.set_theme({ copy_mode = { a = { fg = '#181825', bg = '#f9e2af' }, b = { fg = '#f9e2af', bg = '#313244' } } }) ``` -------------------------------- ### Configure Window Components in tabline.wez Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Configures the layout of the status bar by assigning specific components (like CPU, RAM, or battery) to different sections of the tabline. ```lua local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ sections = { tabline_a = { 'mode' }, tabline_b = { 'workspace' }, tabline_c = { 'window' }, tabline_x = { 'ram', 'cpu' }, tabline_y = { 'datetime', 'battery' }, tabline_z = { 'domain', 'hostname' }, } }) ``` -------------------------------- ### Configure Separator Styles in tabline.wez Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Demonstrates how to customize section, component, and tab separators using Nerd Font glyphs or disable them entirely via the tabline.setup function. ```lua local wezterm = require('wezterm') local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") -- Powerline-style separators tabline.setup({ options = { section_separators = { left = wezterm.nerdfonts.pl_left_hard_divider, right = wezterm.nerdfonts.pl_right_hard_divider, }, component_separators = { left = wezterm.nerdfonts.pl_left_soft_divider, right = wezterm.nerdfonts.pl_right_soft_divider, }, tab_separators = { left = wezterm.nerdfonts.pl_left_hard_divider, right = wezterm.nerdfonts.pl_right_hard_divider, }, } }) -- Rounded separators tabline.setup({ options = { 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, }, } }) -- Disable all separators tabline.setup({ options = { section_separators = '', component_separators = '', tab_separators = '', } }) ``` -------------------------------- ### Retrieve tabline configuration Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Function to retrieve the currently active configuration object for the tabline plugin. ```lua tabline.get_config() ``` -------------------------------- ### Configure CPU and RAM Component Update Interval Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Sets the update interval for the CPU and RAM component in the tabline. The `throttle` option determines how often, in seconds, the component refreshes. Setting `use_pwsh` to `true` enables the use of PowerShell for data retrieval. ```lua sections = { tabline_a = { { 'cpu', throttle = 3, -- How often in seconds the component updates, set to 0 to disable throttling use_pwsh = false, -- If you want use powershell, set to true. default is false } } } ``` -------------------------------- ### Define Custom Extensions Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Explains how to create custom extensions that react to WezTerm events, allowing for dynamic changes to the tabline layout and color scheme. ```lua local wezterm = require('wezterm') local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") local my_extension = { 'my_plugin_name', events = { show = 'my_plugin.activated', hide = 'my_plugin.deactivated', delay = 5, callback = function(window) wezterm.log_info('Extension activated') end, }, sections = { tabline_a = { ' Custom Mode ' }, tabline_b = { 'workspace' }, tabline_c = { 'window' }, tab_active = {}, tab_inactive = {}, }, colors = { a = { fg = '#181825', bg = '#f38ba8' }, b = { fg = '#f38ba8', bg = '#313244' }, c = { fg = '#cdd6f4', bg = '#181825' }, } } tabline.setup({ extensions = { my_extension } }) ``` -------------------------------- ### Configure Battery Icons for Tabline Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Maps battery charge levels to specific icons for display in the tabline. The `battery_to_icon` table defines icons for different battery states like 'empty', 'quarter', 'half', 'three_quarters', and 'full'. This allows for a visual representation of the battery status. ```lua sections = { tabline_a = { { 'battery', battery_to_icon = { empty = { wezterm.nerdfonts.fa_battery_empty, color = { fg = scheme.ansi[2] } }, quarter = wezterm.nerdfonts.fa_battery_quarter, half = wezterm.nerdfonts.fa_battery_half, three_quarters = wezterm.nerdfonts.fa_battery_three_quarters, full = wezterm.nerdfonts.fa_battery_full } } } } ``` -------------------------------- ### Configure Global Tabline Options for Theme and Separators Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md This snippet configures global options for the tabline, including setting a theme and defining custom separators for sections, components, and tabs using WezTerm's nerdfonts. These global settings provide default appearances that can be overridden at the component level. ```lua options = { theme = 'nord', 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, } } ``` -------------------------------- ### Define Custom Tabline Component with Text String Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md This snippet shows how to use a simple text string as a tabline component. WezTerm automatically wraps the string in a Text FormatItem. This is a straightforward way to add static text to the tabline. ```lua sections = { tabline_a = { 'Hello World' } } ``` -------------------------------- ### Apply WezTerm Settings with tabline.apply_to_config() Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt This function applies essential WezTerm configuration settings required for tabline to function correctly. It modifies settings like `use_fancy_tab_bar`, `window_padding`, and `status_update_interval`. ```lua local wezterm = require('wezterm') local config = wezterm.config_builder() local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ options = { theme = 'GruvboxDark' } }) -- Apply recommended settings to WezTerm config -- Sets: use_fancy_tab_bar = false, show_new_tab_button_in_tab_bar = false, -- tab_max_width = 32, window_decorations = 'RESIZE', window_padding = 0, -- status_update_interval = 500 tabline.apply_to_config(config) return config ``` -------------------------------- ### Multiple Events for Tabline Extension Show/Hide in Lua Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md This Lua code illustrates how to specify multiple event names for the 'show' and 'hide' properties within a WezTerm tabline extension. This allows a single extension to respond to several distinct events. ```lua events = { show = { 'my_plugin.show', 'my_plugin.show2' }, hide = { 'my_plugin.hide', 'my_plugin.hide2' } } ``` -------------------------------- ### Implement Custom Function Components for Dynamic Content (Lua) Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Enables the use of custom Lua functions as tabline components, allowing for dynamic content generation based on the current window or tab state. These functions can interact with the system, such as checking Git branches or counting panes. Requires wezterm and tabline.wez. ```lua local wezterm = require('wezterm') local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") -- Custom function component for window sections local function git_branch(window) local cwd = window:active_pane():get_current_working_dir() if cwd then local success, stdout = wezterm.run_child_process({ 'git', '-C', cwd.file_path, 'branch', '--show-current' }) if success then return wezterm.nerdfonts.dev_git_branch .. ' ' .. stdout:gsub('%s+', '') end end return '' end -- Custom function component for tab sections local function pane_count(tab) local count = #tab.panes if count > 1 then return '[' .. count .. ']' end return '' end tabline.setup({ sections = { tabline_c = { git_branch }, -- Function receives Window object tab_active = { 'index', { 'cwd', padding = { left = 0, right = 1 } }, pane_count, -- Function receives TabInformation object }, } }) ``` -------------------------------- ### Define Custom Tabline Extension in Lua Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md This snippet demonstrates how to define a custom extension for the WezTerm tabline using Lua. It includes defining the extension name, events like 'show' and 'hide' with optional delay and callback, sections to display, and custom colors. ```lua local my_extension = { 'my_extension_name', events = { show = 'my_plugin.show', hide = 'my_plugin.hide', delay = 3, callback = function(window) wezterm.log_info('Extension was shown') end }, sections = { tabline_a = { 'mode' } }, colors = { a = { fg = '#181825', bg = '#f38ba8' }, b = { fg = '#f38ba8', bg = '#313244' }, c = { fg = '#cdd6f4', bg = '#181825' }, } } tabline.setup({ extensions = { my_extension } }) ``` -------------------------------- ### Customize battery level icons in WezTerm tabline Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Configures the battery component to display specific icons based on charge levels. It supports custom colors for different states using the tabline.setup function. ```lua local wezterm = require('wezterm') local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") local theme = tabline.get_theme() tabline.setup({ sections = { tabline_y = { { 'battery', battery_to_icon = { empty = { wezterm.nerdfonts.fa_battery_empty, color = { fg = theme.colors.ansi[2] } }, quarter = wezterm.nerdfonts.fa_battery_quarter, half = wezterm.nerdfonts.fa_battery_half, three_quarters = wezterm.nerdfonts.fa_battery_three_quarters, full = { wezterm.nerdfonts.fa_battery_full, color = { fg = theme.colors.ansi[3] } }, }, }, }, } }) ``` -------------------------------- ### Retrieve Current tabline.wez Configuration Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt This code snippet demonstrates how to retrieve the current configuration object of the tabline.wez plugin. This is useful for debugging or inspecting the active settings. ```lua local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ options = { theme = 'Tokyo Night' }, sections = { tabline_a = { 'mode' }, tabline_z = { 'hostname' } } }) -- Get current configuration local current_config = tabline.get_config() -- current_config.options.theme == 'Tokyo Night' -- current_config.sections.tabline_a == { 'mode' } ``` -------------------------------- ### Configure Tab Components for Active and Inactive Tabs (Lua) Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Sets up specific components to be displayed for active and inactive tabs. These components can access the TabInformation object and include elements like tab index, directory paths, process names, and indicators for zoomed panes or unseen output. Requires the tabline.wez plugin. ```lua local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup({ sections = { tab_active = { 'index', -- Tab index number { 'parent', padding = 0 }, -- Parent directory name '/', -- Static text separator { 'cwd', padding = { left = 0, right = 1 } }, -- Current working directory { 'zoomed', padding = 0 }, -- Zoomed pane indicator }, tab_inactive = { 'index', { 'process', padding = { left = 0, right = 1 } }, -- Running process name { 'output', icon_no_output = nil }, -- Unseen output indicator }, } }) -- Available tab components: -- 'tab' - Tab title -- 'index' - Tab index (zero_indexed option available) -- 'cwd' - Current working directory (max_length option available) -- 'parent' - Parent directory (max_length option available) -- 'process' - Foreground process name with auto-detected icon -- 'zoomed' - Indicator when tab has zoomed pane -- 'output' - Indicator for unseen output in background tabs ``` -------------------------------- ### Configure Output Notification Icon Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Sets the icon to be displayed in the tabline when there is no unseen output. The `icon_no_output` option can be set to `nil` if an icon should only appear when there is unseen output. This helps in quickly identifying new information. ```lua sections = { tab_inactive = { { 'output', icon_no_output = wezterm.nerdfonts.md_bell_outline -- Which icon to show when there is no unseen output. Can be set to nil if you only want to show an icon when there is unseen output. } } } ``` -------------------------------- ### Define Custom Tabline Component with Lua Function Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md This snippet demonstrates how to create a custom tabline component by defining a Lua function that returns a string. The function is then assigned to a section in the `sections` table. Functions used as components receive either the Window or TabInformation object as an argument. ```lua local function hello() return 'Hello World' end sections = { tabline_a = { hello } } ``` -------------------------------- ### Set WezTerm Tabline Theme Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Sets the color theme for the tabline. It uses WezTerm's built-in color schemes or allows custom color objects. Ensure the chosen theme provides necessary colors for extensions. ```lua options = { theme = 'GruvboxDark' } ``` ```lua options = { theme = config.colors } ``` -------------------------------- ### Manually Refresh tabline.wez Source: https://context7.com/michaelbrusegard/tabline.wez/llms.txt Provides a method to trigger a manual refresh of the tabline, which is useful when integrating with WezTerm events or custom user variables. ```lua local wezterm = require('wezterm') local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez") tabline.setup() wezterm.on('user-var-changed', function(window, pane, name, value) if name == 'refresh-tabline' then tabline.refresh(window, nil) end end) ``` -------------------------------- ### Configure WezTerm Tabline Separators Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Defines the separators used between sections, components, and tabs in the tabline. It utilizes WezTerm's nerdfonts for divider characters and allows disabling separators by setting them to an empty string. ```lua options = { section_separators = { left = wezterm.nerdfonts.pl_left_hard_divider, right = wezterm.nerdfonts.pl_right_hard_divider, }, component_separators = { left = wezterm.nerdfonts.pl_left_soft_divider, right = wezterm.nerdfonts.pl_right_soft_divider, }, tab_separators = { left = wezterm.nerdfonts.pl_left_hard_divider, right = wezterm.nerdfonts.pl_right_hard_divider, }, } ``` ```lua options = { section_separators = '', component_separators = '', tab_separators = '', } ``` -------------------------------- ### Customize WezTerm Tabline Theme Overrides Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md Allows modification of specific theme elements, such as the background color of a tabline section for a given mode. It also supports defining colors for new key tables (modes) by appending '_mode' to the key table name. ```lua -- Change the background of tabline_c section for normal mode tabline.setup({ options = { theme_overrides = { normal_mode = { c = { bg = '#112233' }, }, } } }) ``` ```lua tabline.setup({ options = { theme_overrides = { -- Default colors from Catppuccin Mocha normal_mode = { a = { fg = '#181825', bg = '#89b4fa' }, b = { fg = '#89b4fa', bg = '#313244' }, c = { fg = '#cdd6f4', bg = '#181825' }, }, copy_mode = { a = { fg = '#181825', bg = '#f9e2af' }, b = { fg = '#f9e2af', bg = '#313244' }, c = { fg = '#cdd6f4', bg = '#181825' }, }, search_mode = { a = { fg = '#181825', bg = '#a6e3a1' }, b = { fg = '#a6e3a1', bg = '#313244' }, c = { fg = '#cdd6f4', bg = '#181825' }, }, -- Defining colors for a new key table window_mode = { a = { fg = '#181825', bg = '#cba6f7' }, b = { fg = '#cba6f7', bg = '#313244' }, c = { fg = '#cdd6f4', bg = '#181825' }, }, -- Default tab colors tab = { active = { fg = '#89b4fa', bg = '#313244' }, inactive = { fg = '#cdd6f4', bg = '#181825' }, inactive_hover = { fg = '#f5c2e7', bg = '#313244' } } } } }) ``` -------------------------------- ### Manually Refresh Tabline in Lua Source: https://github.com/michaelbrusegard/tabline.wez/blob/main/README.md This Lua snippet shows how to manually refresh the WezTerm tabline. The `tabline.refresh` function requires both the `window` and `tab` objects. Passing `nil` for either argument will prevent the respective section from refreshing. ```lua tabline.refresh(window, tab) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.