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()ortab:active_pane() - The
wezterm.muxmodule methods
Properties
pane:pane_id()
Returns the unique pane identifier. Returns:number - The pane ID
Navigation Methods
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 typicallywezterm 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 of lines to retrieve. If omitted, returns all viewport lines.
string - Text with trailing whitespace trimmed
pane:get_lines_as_escapes(nlines?)
Returns lines with ANSI escape sequences preserved.Number of lines to retrieve. If omitted, returns all viewport lines.
string
pane:get_logical_lines_as_text(nlines?)
Returns logical lines (respecting line wrapping) as text.Number of lines to retrieve. If omitted, returns all viewport lines.
string
pane:get_text_from_region(start_x, start_y, end_x, end_y)
Extracts text from a specific region of the terminal.Starting column (0-based)
Starting row (stable row index)
Ending column (0-based)
Ending row (stable row index)
string
Semantic Zone Methods
pane:get_semantic_zones(type?)
Returns semantic zones in the pane (prompts, commands, output regions).Filter by semantic type (e.g., “Output”, “Input”, “Prompt”)
SemanticZone[]
pane:get_semantic_zone_at(x, y)
Returns the semantic zone at the specified coordinates.Column position
Row position (stable row index)
SemanticZone | nil
pane:get_text_from_semantic_zone(zone)
Extracts text from a semantic zone.The semantic zone object
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 columnsrows- number of rowsviewport_rows- number of visible rowsphysical_top- top of physical scrollbackscrollback_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.Text to send to the pane
pane:send_paste(text)
Sends text to the pane in bracketed paste mode.Text to paste
pane:paste(text)
Alias forsend_paste(). Exists for backwards compatibility.
Text to paste
pane:inject_output(text)
Injects escape sequences directly into the terminal emulator.Text with ANSI escape sequences
Manipulation Methods
pane:split(args?)
Splits the pane and spawns a program into the new pane.Configuration table for the split operation
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.Name of the workspace for the new window
(MuxTab, MuxWindow) - The new tab and window