Skip to content
41 changes: 39 additions & 2 deletions lua/wezterm/types/objects/mux-tab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,43 @@
---@field pixel_height integer
---@field dpi number

---Mirrors `MuxPaneInfo` in wezterm upstream:
---https://github.com/wezterm/wezterm/blob/main/lua-api-crates/mux/src/lib.rs
---
---@class MuxTab.PaneInfo
---The topological pane index.
---
---@field index integer
---If `true` then this is the active pane within this tab.
---
---@field is_active boolean
---Is `true` if the pane is in the zoomed state.
---
---@field is_zoomed boolean
---The offset from the top left corner of the containing tab
---to the top left corner of this pane, in cells.
---
---@field left integer
---The offset from the top left corner of the containing tab
---to the top left corner of this pane, in cells.
---
---@field top integer
---The width of the pane in cells.
---
---@field width integer
---The height of the pane in cells.
---
---@field height integer
---The width of the pane in pixels.
---
---@field pixel_width integer
---The height of the pane in pixels.
---
---@field pixel_height integer
---A `Pane` object.
---
---@field pane Pane

---`MuxTab` represents a tab that is managed
---by the multiplexer.
---
Expand Down Expand Up @@ -59,9 +96,9 @@ function M:panes() end
---for each of the panes contained by this tab.
---
---See:
--- - [`PaneInformation`](lua://PaneInformation)
--- - [`MuxTab.PaneInfo`](lua://MuxTab.PaneInfo)
---
---@return PaneInformation[] info_panes
---@return MuxTab.PaneInfo[] info_panes
function M:panes_with_info() end

---Rotates the panes in the clockwise direction.
Expand Down
60 changes: 52 additions & 8 deletions lua/wezterm/types/objects/pane-information.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
---@meta

---Mirrors `Progress` in wezterm upstream:
---https://github.com/wezterm/wezterm/blob/main/term/src/terminal.rs
---
---@alias PaneProgress
---|"None"
---|"Indeterminate"
---|{ Percentage: integer }
---|{ Error: integer }

---Describes a [`Pane`](lua://Pane).
---
---Unlike the `Pane` object, `PaneInformation` is a snapshot of
---some of the key characteristics of the pane,
---intended for use in synchronous, fast, event callbacks
---that format GUI elements such as the window and tab title bars.
---
---Mirrors `PaneInformation` in wezterm upstream:
---https://github.com/wezterm/wezterm/blob/main/wezterm-gui/src/termwindow/mod.rs
---
---@class PaneInformation
---The height of the pane in cells.
---
---@field height number
---@field height integer
---Is `true` if the pane is the active pane within its containing tab.
---
---@field is_active boolean
Expand All @@ -19,39 +31,71 @@
---@field is_zoomed boolean
---The cell `x` coordinate of the left edge of the pane.
---
---@field left number
---@field left integer
---The height of the pane in pixels.
---
---@field pixel_height number
---@field pixel_height integer
---The pane ID.
---
---@field pane_id integer
---The logical position of the pane within its containing layout.
---
---@field pane_index number
---@field pane_index integer
---The width of the pane in pixels.
---
---@field pixel_width number
---@field pixel_width integer
---The progress state,
---per [`Pane:get_progress()`](lua://Pane.get_progress)
---at the time the pane information was captured.
---
---@field progress string
---@field progress PaneProgress
---The title of the pane,
---per [`Pane:get_title()`](lua://Pane.get_title)
---at the time the pane information was captured.
---
---@field title string
---The cell `y` coordinate of the top edge of the pane.
---
---@field top number
---@field top integer
---The user variables defined for the pane,
---per [`Pane:get_user_vars()`](lua://Pane.get_user_vars)
---at the time the pane information was captured.
---
---@field user_vars table<string, string>
---The width of the pane in cells.
---
---@field width number
---@field width integer
---The path to the executable image, per `Pane:get_foreground_process_name()`.
---
---If the path is unavailable then this field will be an empty string.
---
---For more information, see:
--- - [`Pane:get_foreground_process_name()`](lua://Pane.get_foreground_process_name)
---
---@field foreground_process_name string|""
---The current working directory, per `Pane:get_current_working_dir()`.
---
---For more information, see:
--- -[`Pane:get_current_working_dir()`](lua://Pane.get_current_working_dir)
---
---@field current_working_dir Url|nil
---Returns `true` if there has been output in the pane
---since the last time the pane was focused.
---
---@field has_unseen_output boolean
---The name of the domain with which the pane is associated, per `Pane:get_domain_name()`.
---
---If the domain name is unavailable then this field will be an empty string.
---
---For more information, see:
--- - [`Pane:get_domain_name()`](lua://Pane.get_domain_name)
---
---@field domain_name string|""
---The tty device name, per `Pane:get_tty_name()`.
---
---For more information, see:
--- - [`Pane:get_tty_name()`](lua://Pane.get_tty_name)
---
---@field tty_name string|nil

-- vim: set ts=2 sts=2 sw=2 et ai si sta:
5 changes: 4 additions & 1 deletion lua/wezterm/types/objects/pane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,10 @@ function M:get_metadata() end
---will be `"None"` to indicate that
---no progress has been reported.
---
---@return string|"None" progress
---Mirrors the `get_progress` Lua binding in wezterm upstream:
---https://github.com/wezterm/wezterm/blob/main/lua-api-crates/mux/src/pane.rs
---
---@return PaneProgress progress
function M:get_progress() end

---Resolves the semantic zone that encapsulates
Expand Down
6 changes: 4 additions & 2 deletions lua/wezterm/types/wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,6 @@ function Wezterm.on(event, callback) end
---it doesn't make sense to define multiple instances of the event
---with multiple `wezterm.on("format-window-title", ...)` calls.
---
--- ---
---The `"format-window-title"` event is emitted when the text for the window title
---needs to be recomputed.
---
Expand All @@ -1441,8 +1440,11 @@ function Wezterm.on(event, callback) end
---For more information, see:
--- - [`wezterm.run_child_process()`](lua://Wezterm.run_child_process)
---
---Mirrors the `format-window-title` callback arguments in wezterm upstream:
---https://github.com/wezterm/wezterm/blob/main/wezterm-gui/src/termwindow/mod.rs
---
---@param event "format-window-title"
---@param callback fun(window: Window, pane: Pane, tabs: MuxTab[], panes: Pane[], config: Config): string
---@param callback fun(tab: TabInformation, pane: PaneInformation, tabs: TabInformation[], panes: PaneInformation[], config: Config): string
function Wezterm.on(event, callback) end

---This event is triggered when the GUI is starting up after attaching the selected domain.
Expand Down