Window object represents a GUI terminal window in WezTerm. It provides methods to interact with the window’s state, manage tabs, access configuration, and control the user interface.
Window objects cannot be created directly in Lua code; they are typically passed to your code via event callbacks.
How to Access
Window objects are commonly accessed through:- Event callbacks (e.g.,
update-status,window-config-reloaded) - The first parameter in many event handlers
Identification
window:window_id()
Returns the unique window identifier. Returns:number - The window ID
Navigation Methods
window:active_tab()
Returns the currently active tab in this window. Returns:MuxTab | nil
window:active_pane()
Returns the currently active pane in the active tab. Returns:Pane | nil
window:mux_window()
Returns the MuxWindow object for this GUI window. Returns:MuxWindow | nil
State and Configuration
window:effective_config()
Returns the effective configuration for this window, including any overrides. Returns:Config - The merged configuration object
window:get_config_overrides()
Returns the table of configuration overrides set for this window. Returns:table
window:set_config_overrides(overrides)
Sets configuration overrides for this specific window.table
required
Table of configuration values to override. Pass an empty table or
nil to clear overrides.window:get_appearance()
Returns the system appearance (light/dark mode). Returns:string - Either “Light” or “Dark”
Workspace
window:active_workspace()
Returns the name of the active workspace for this window. Returns:string
Dimensions
window:get_dimensions()
Returns dimensional information about the window. Returns: Table with fields:pixel_width- window width in pixelspixel_height- window height in pixelsdpi- DPI of the screen the window is onis_full_screen- whether window is in full screen mode
window:set_inner_size(width, height)
Sets the inner size of the window in pixels.number
required
Width in pixels
number
required
Height in pixels
window:set_position(x, y)
Sets the window position on screen.number
required
X coordinate in pixels
number
required
Y coordinate in pixels
Window State
window:is_focused()
Returns whether this window currently has focus. Returns:boolean
window:focus()
Brings this window to the front and gives it keyboard focus.window:maximize()
Maximizes the window.window:restore()
Restores the window from maximized or minimized state.window:toggle_fullscreen()
Toggles full screen mode.Status Bar
window:set_left_status(text)
Sets the left status bar text.string | table
required
Text to display, or a table of formatted elements
window:set_right_status(text)
Sets the right status bar text.string | table
required
Text to display, or a table of formatted elements
Keyboard State
window:keyboard_modifiers()
Returns the currently pressed keyboard modifiers. Returns: Table with boolean fields:CTRLALT/OPTSHIFTSUPER/CMD
window:leader_is_active()
Returns whether the leader key is currently active. Returns:boolean
window:active_key_table()
Returns the name of the currently active key table, if any. Returns:string | nil
Composition Status
window:composition_status()
Returns the input method composition status. Returns:string | nil - The composition text, if active
Selection and Clipboard
window:get_selection_text_for_pane(pane)
Returns the selected text in a specific pane as plain text.Pane
required
The pane to get selection from
string
window:get_selection_escapes_for_pane(pane)
Returns the selected text with ANSI escape sequences preserved.Pane
required
The pane to get selection from
string
window:copy_to_clipboard(text, clipboard?)
Copies text to the system clipboard.string
required
Text to copy
string
Clipboard to use: “Clipboard” (default), “PrimarySelection”
Actions and Notifications
window:perform_action(action, pane)
Programmatically performs a key assignment action.KeyAssignment
required
The action to perform
Pane
required
The pane to perform the action on
boolean - Whether the action was handled
window:toast_notification(title, message, url?, timeout?)
Displays a toast notification.string
required
Notification title
string
required
Notification message
string
URL to open when notification is clicked
number
Timeout in milliseconds