Skip to main content
A Pane object represents a live instance of a pane in the WezTerm multiplexer. It tracks the pseudo terminal (or real serial terminal), associated processes, and the parsed screen and scrollback buffer. Pane objects are typically passed to your code via event callbacks. You can use a Pane object to send input to associated processes and introspect the terminal emulation state.
Since version 20221119-145034-49b9839f, there is only the underlying mux pane (previously there were separate MuxPane and Pane objects). These docs refer to it as Pane for simplicity.

How to Access

Pane objects are commonly accessed through:
  • Event callbacks (e.g., update-status, format-tab-title)
  • Window and Tab methods like window:active_pane() or tab:active_pane()
  • The wezterm.mux module methods

Properties

pane:pane_id()

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

pane:tab()

Returns the MuxTab object that contains this pane. Returns: MuxTab | nil

pane:window()

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

pane:mux_pane()

Returns the pane itself. This method exists for backwards compatibility when there were separate GUI and Mux pane objects. Returns: Pane

Content Retrieval Methods

pane:get_title()

Returns the title of the pane. This is typically wezterm by default but can be modified by applications using OSC 1 (Icon/Tab title) and/or OSC 2 (Window title) escape sequences. Returns: string

pane:get_current_working_dir()

Returns the current working directory of the pane, if available. Returns: Url | nil - A URL object representing the working directory

pane:get_foreground_process_name()

Returns the executable path of the foreground process. Returns: string | nil

pane:get_foreground_process_info()

Returns detailed information about the foreground process. Returns: LocalProcessInfo | nil

pane:get_user_vars()

Returns user variables that have been set in the pane environment. Returns: table<string, string>

pane:get_metadata()

Returns metadata associated with the pane. Returns: dynamic - Dynamic metadata value

pane:get_domain_name()

Returns the name of the domain this pane belongs to. Returns: string

pane:get_tty_name()

Returns the TTY device name associated with this pane. Returns: string | nil

Screen Content Methods

pane:get_lines_as_text(nlines?)

Returns lines from the viewport as plain text (no escape sequences).
number
Number of lines to retrieve. If omitted, returns all viewport lines.
Returns: string - Text with trailing whitespace trimmed

pane:get_lines_as_escapes(nlines?)

Returns lines with ANSI escape sequences preserved.
number
Number of lines to retrieve. If omitted, returns all viewport lines.
Returns: string

pane:get_logical_lines_as_text(nlines?)

Returns logical lines (respecting line wrapping) as text.
number
Number of lines to retrieve. If omitted, returns all viewport lines.
Returns: string

pane:get_text_from_region(start_x, start_y, end_x, end_y)

Extracts text from a specific region of the terminal.
number
required
Starting column (0-based)
number
required
Starting row (stable row index)
number
required
Ending column (0-based)
number
required
Ending row (stable row index)
Returns: string

Semantic Zone Methods

pane:get_semantic_zones(type?)

Returns semantic zones in the pane (prompts, commands, output regions).
SemanticType
Filter by semantic type (e.g., “Output”, “Input”, “Prompt”)
Returns: SemanticZone[]

pane:get_semantic_zone_at(x, y)

Returns the semantic zone at the specified coordinates.
number
required
Column position
number
required
Row position (stable row index)
Returns: SemanticZone | nil

pane:get_text_from_semantic_zone(zone)

Extracts text from a semantic zone.
SemanticZone
required
The semantic zone object
Returns: string

Position and State Methods

pane:get_cursor_position()

Returns the current cursor position. Returns: {x: number, y: number, shape: string, visibility: string}

pane:get_dimensions()

Returns dimensional information about the pane. Returns: Table with fields:
  • cols - number of columns
  • rows - number of rows
  • viewport_rows - number of visible rows
  • physical_top - top of physical scrollback
  • scrollback_rows - number of scrollback rows

pane:get_progress()

Returns the progress indicator state, if any. Returns: number | nil - Progress value between 0 and 1

pane:has_unseen_output()

Returns whether the pane has received output since last being focused. Returns: boolean

pane:is_alt_screen_active()

Returns whether the alternate screen buffer is active. Returns: boolean

Input Methods

pane:send_text(text)

Sends text directly to the pane as if typed.
string
required
Text to send to the pane

pane:send_paste(text)

Sends text to the pane in bracketed paste mode.
string
required
Text to paste

pane:paste(text)

Alias for send_paste(). Exists for backwards compatibility.
string
required
Text to paste

pane:inject_output(text)

Injects escape sequences directly into the terminal emulator.
string
required
Text with ANSI escape sequences

Manipulation Methods

pane:split(args?)

Splits the pane and spawns a program into the new pane.
table
Configuration table for the split operation
Arguments table fields: Returns: Pane - The newly created pane

pane:activate()

Activates this pane (makes it the focused pane in its tab and window).

pane:move_to_new_tab()

Moves this pane to a new tab in the same window. Returns: (MuxTab, MuxWindow) - The new tab and its containing window

pane:move_to_new_window(workspace?)

Moves this pane to a new window, optionally in a specific workspace.
string
Name of the workspace for the new window
Returns: (MuxTab, MuxWindow) - The new tab and window

Example: Status Line with Pane Info

Example: Working with Semantic Zones