Detected capabilities of the host terminal. More...
Static Public Member Functions | |
| static TerminalCapabilities | Detect () |
| Probe the environment and return a TerminalCapabilities instance reflecting what the current terminal supports. | |
Static Public Attributes | |
| static readonly TerminalCapabilities | None = new() |
| No optional capabilities — all flags false. Suitable as a safe default. | |
| static readonly TerminalCapabilities | WithKitty = new() { SupportsKittyGraphics = true } |
| Kitty graphics supported, no tmux offsets. Useful for tests and explicit overrides. | |
Properties | |
| bool | InsideTmux [get] |
| True when running inside a tmux session, which means Kitty graphics sequences must be wrapped in DCS passthrough blocks and stationary placements renewed each frame against tmux's re-render cursor drift. | |
| bool | SupportsKittyGraphics [get] |
True when the terminal supports the Kitty graphics protocol (ESC _ G … ESC </c> APC sequences for pixel image rendering).
| |
| int | TmuxPaneColOffset [get] |
| When running inside tmux, the number of terminal columns to the left of the active pane (non-zero when panes are arranged side-by-side). | |
| int | TmuxPaneRowOffset [get] |
| When running inside tmux, the number of terminal rows above the active pane (i.e. | |
Detected capabilities of the host terminal.
Injected into widgets that need to adapt their rendering strategy at runtime (e.g. ImageWidget choosing between Kitty graphics and half-block Unicode fallback).
Obtain an instance via Detect at application startup (before entering raw mode and the alternate screen), or construct a known configuration with None / WithKitty for tests or explicit overrides.
|
static |
Probe the environment and return a TerminalCapabilities instance reflecting what the current terminal supports.
Kitty detection checks a prioritised set of well-known environment variables. Variables that propagate through tmux sessions are tried first (e.g. WEZTERM_PANE is set by WezTerm and survives inside tmux).
TERM=xterm-kitty or KITTY_WINDOW_ID WEZTERM_PANE, WEZTERM_UNIX_SOCKET, or TERM_PROGRAM=WezTerm TERM=xterm-ghostty or GHOSTTY_RESOURCES_DIR TERM=foot or TERM=foot-extra tmux pane offsets: When inside tmux the method runs tmux display once to determine the pane's absolute position in the terminal window, including status-bar height. These offsets correct Kitty image placement when the status bar is positioned above the pane.
Call before ITerminal.EnterRawMode and ITerminal.EnterAlternateScreen.
|
get |
True when running inside a tmux session, which means Kitty graphics sequences must be wrapped in DCS passthrough blocks and stationary placements renewed each frame against tmux's re-render cursor drift.
Detect sets this from TMUX and TERM. Set it explicitly to state the mode rather than inherit it from the ambient environment — which is what tests should do, so a suite does not pass or fail according to whether the developer happens to be running inside tmux.
|
get |
When running inside tmux, the number of terminal columns to the left of the active pane (non-zero when panes are arranged side-by-side).
0 when not in tmux or pane starts at the left edge.
|
get |
When running inside tmux, the number of terminal rows above the active pane (i.e.
the height of status bars positioned at the top of the window). 0 when not in tmux or when the status bar is at the bottom.
Used to convert pane-relative row coordinates to absolute terminal coordinates when embedding cursor-positioning escapes inside DCS passthrough blocks for Kitty graphics placement.