Available since version
20220624-141144-bd1b7c5d.MuxWindow object represents a window that is managed by the WezTerm multiplexer. It contains tabs and provides methods to manage them and the window’s state.
MuxWindow objects represent the logical window in the multiplexer layer, as opposed to the GUI Window object which represents the physical GUI window.
How to Access
MuxWindow objects are commonly accessed through:- The
window:mux_window()method from a GUI Window - The
pane:window()method - The
tab:window()method - The
wezterm.muxmodule functions
Identification
mux_window:window_id()
Returns the unique multiplexer window identifier. Returns:number - The mux window ID
GUI Window Access
mux_window:gui_window()
Returns the GUI Window object for this multiplexer window, if one exists. This is an async method because the GUI window may not exist yet (e.g., in a headless multiplexer scenario). Returns:Window | nil
Workspace Methods
mux_window:get_workspace()
Returns the name of the workspace this window belongs to. Returns:string
mux_window:set_workspace(name)
Moves this window to a different workspace.string
required
The name of the workspace to switch to
Title Methods
mux_window:get_title()
Returns the title of the window. Returns:string
mux_window:set_title(title)
Sets the title of the window.string
required
The new title for the window
Tab Management
mux_window:tabs()
Returns an array of all tabs in this window. Returns:MuxTab[]
mux_window:tabs_with_info()
Returns an array of tabs with additional information. Returns: Array of tables, each containing:number
The position of the tab within the window (0-based)
boolean
Whether this is the active tab
MuxTab
The MuxTab object
mux_window:active_tab()
Returns the currently active tab in this window. Returns:MuxTab | nil
mux_window:active_pane()
Returns the active pane in the active tab. Returns:Pane | nil
mux_window:spawn_tab(args)
Spawns a new tab in this window.table
required
Configuration table for the new tab
MuxTab - The newly created tab
Example: Window Information Display
Example: Spawn Tab with Keybinding
Example: Workspace Switcher
Example: Tab Manager
Relationship to GUI Window
TheMuxWindow is the logical window in the multiplexer, while the GUI Window is the physical window you see on screen:
- MuxWindow: Exists in the multiplexer layer, can exist without a GUI (e.g., in
wezterm clicontexts) - GUI Window: The actual rendered window with GUI-specific methods like
set_right_status(),get_appearance(), etc.