Skip to main content
Window events are emitted throughout the lifecycle of WezTerm windows and panes. These events allow you to customize window behavior, format UI elements, and respond to user interactions.

Formatting and UI Events

format-tab-title

Since: 20210502-130208-bff6815d Emitted when tab title text needs to be computed or recomputed.

Characteristics

  • Synchronous event - Must return immediately to avoid blocking UI
  • Cannot call asynchronous functions like wezterm.run_child_process()
  • Called twice per tab: once for measurement, once for rendering
  • Only the first registered handler is executed

Event Signature

TabInformation
Information about the tab being formatted. Contains tab_title, active_pane, is_active, and more.
TabInformation[]
Array of all tabs in the window.
PaneInformation[]
Array of all panes in the active tab.
table
Effective configuration for the window.
boolean
True if mouse is hovering over this tab. False on first pass (measurement).
number
Maximum cells available for this tab. Set to tab_max_width on first pass.

Return Values

string
Plain text for the tab title
table
Array of format items with text, colors, and attributes (same as wezterm.format())

Examples

Basic Tab Title
Fancy Tab Bar with Icons
Tab Index and Count

format-window-title

Since: 20210314-114017-04b7cedd Emitted when the window title needs to be formatted.

Status Bar Events

update-status

Since: 20220903-194523-3bb1ed61 Emitted periodically based on status_update_interval configuration.

Characteristics

  • Asynchronous - can perform longer operations
  • Only one instance runs at a time (coalesced if handler is slow)
  • Won’t schedule next call until status_update_interval ms after previous call completes

Event Signature

Window
GUI window object with methods like set_left_status() and set_right_status()
Pane
Active pane in the window

Examples

Clock in Status Bar
Workspace Indicator
Battery and System Info

update-right-status

Deprecated in favor of update-status. Use update-status instead.

Interaction Events

bell

Since: 20211204-082213-a66c61ee9 Emitted when ASCII BEL sequence is received by a pane.

Characteristics

  • Fire-and-forget event
  • Does not alter WezTerm’s bell handling (supplements it)
  • Pane may not be the active pane

open-uri

Emitted when a URI is activated (e.g., clicking a link).

Event Signature

string
The URI that was activated

Return Value

boolean
Prevent default browser opening
nil
Allow default handling

Examples

Custom mailto Handler
JIRA Integration

new-tab-button-click

Since: 20230326-111934-3666303c Emitted when the + button in the tab bar is clicked.

augment-command-palette

Since: 20230712-072601-f4abf8fd Emitted when Command Palette is shown. Add custom entries.

Characteristics

  • Synchronous - no async operations allowed
  • Returns array of command entries

Lifecycle Events

window-resized

Since: 20210314-114017-04b7cedd Emitted when window is resized or enters/exits fullscreen.

Characteristics

  • Asynchronous with respect to resize operation
  • Coalesced: max 1 executing + 1 buffered during live resize
Adaptive Padding in Fullscreen

window-config-reloaded

Since: 20210314-114017-04b7cedd Emitted when window configuration is reloaded.

Triggers

  • Configuration file changes (when automatically_reload_config is enabled)
  • ReloadConfiguration key action
  • window:set_config_overrides() is called

Important

Calling window:set_config_overrides() inside this event triggers another event. Avoid loops by only calling when values actually change.

window-focus-changed

Since: 20221119-145034-49b9839f Emitted when window focus state changes.
Dim Unfocused Windows

user-var-changed

Since: 20220903-194523-3bb1ed61 Emitted when a user variable is set via escape sequence.

Setting User Vars

From shell:

Event Handler

Common Patterns

Status Bar with Multiple Sections

Conditional UI Based on Pane

See Also