Skip to main content
The Tab object is also known as MuxTab in the WezTerm codebase. Available since version 20220624-141144-bd1b7c5d.
A MuxTab object represents a tab that is managed by the WezTerm multiplexer. It contains one or more panes arranged in a layout and provides methods to manage those panes and the tab’s state. Tab objects cannot be created directly in Lua; they are typically accessed through window methods or event callbacks.

How to Access

Tab objects are commonly accessed through:
  • The window:active_tab() method
  • The pane:tab() method
  • Event callbacks
  • The wezterm.mux module

Identification

tab:tab_id()

Returns the unique tab identifier. Returns: number - The tab ID

tab:window()

Returns the MuxWindow object that contains this tab. Returns: MuxWindow | nil

tab:active_pane()

Returns the currently active pane in this tab. Returns: Pane | nil

tab:panes()

Returns an array of all panes in this tab (ignoring zoom state). Returns: Pane[]

tab:panes_with_info()

Returns an array of panes with extended layout information. Returns: Array of tables, each containing:
number
The topological pane index
boolean
Whether this is the active pane in the tab
boolean
Whether this pane is zoomed
number
X offset from top-left of tab, in cells
number
Y offset from top-left of tab, in cells
number
Width of the pane in cells
number
Height of the pane in cells
number
Width of the pane in pixels
number
Height of the pane in pixels
Pane
The Pane object

tab:get_pane_direction(direction)

Returns the pane in a specific direction relative to the active pane.
string
required
Direction to search: “Left”, “Right”, “Up”, or “Down”
Returns: Pane | nil

Title Methods

tab:get_title()

Returns the title of the tab. Returns: string

tab:set_title(title)

Sets the title of the tab.
string
required
The new title for the tab

Size and Layout

tab:get_size()

Returns the size of the tab in cells. Returns: Table with fields:
  • rows - number of rows
  • cols - number of columns
  • pixel_width - width in pixels
  • pixel_height - height in pixels
  • dpi - DPI setting

tab:set_zoomed(zoomed)

Sets the zoom state of the active pane.
boolean
required
Whether to zoom the active pane
Returns: boolean - The previous zoom state

Pane Rotation

tab:rotate_clockwise()

Rotates panes clockwise within the tab layout.
Due to a bug in the implementation, this method currently rotates counter-clockwise despite its name.

tab:rotate_counter_clockwise()

Rotates panes counter-clockwise within the tab layout.

Activation

tab:activate()

Makes this tab the active tab in its window.

Example: Tab Information Display

Example: Navigate Between Panes

Example: Layout Inspector

Example: Zoom Toggle with Indicator