pub struct TerminalCapabilities {Show 16 fields
pub true_color: bool,
pub colors_256: bool,
pub unicode_box_drawing: bool,
pub unicode_emoji: bool,
pub double_width: bool,
pub sync_output: bool,
pub osc8_hyperlinks: bool,
pub scroll_region: bool,
pub in_tmux: bool,
pub in_screen: bool,
pub in_zellij: bool,
pub kitty_keyboard: bool,
pub focus_events: bool,
pub bracketed_paste: bool,
pub mouse_sgr: bool,
pub osc52_clipboard: bool,
/* private fields */
}Expand description
Fields§
§true_color: boolTrue color (24-bit RGB) support.
colors_256: bool256-color palette support.
unicode_box_drawing: boolUnicode box-drawing support.
unicode_emoji: boolEmoji glyph support.
double_width: boolDouble-width glyph support (CJK/emoji).
sync_output: boolSynchronized output (DEC mode 2026) to reduce flicker.
osc8_hyperlinks: boolOSC 8 hyperlinks support.
scroll_region: boolScroll region support (DECSTBM).
in_tmux: boolRunning inside tmux.
in_screen: boolRunning inside GNU screen.
in_zellij: boolRunning inside Zellij.
kitty_keyboard: boolKitty keyboard protocol support.
focus_events: boolFocus event reporting support.
bracketed_paste: boolBracketed paste mode support.
mouse_sgr: boolSGR mouse protocol support.
osc52_clipboard: boolOSC 52 clipboard support (best-effort, security restricted in some terminals).
Implementations§
Source§impl TerminalCapabilities
impl TerminalCapabilities
Sourcepub fn with_overrides() -> Self
pub fn with_overrides() -> Self
Detect capabilities and apply any active thread-local overrides.
This is the recommended way to get capabilities in code that may be running under test with overrides.
Sourcepub fn with_overrides_from(self, base: Self) -> Self
pub fn with_overrides_from(self, base: Self) -> Self
Apply overrides to these capabilities.
Source§impl TerminalCapabilities
impl TerminalCapabilities
Sourcepub const fn profile(&self) -> TerminalProfile
pub const fn profile(&self) -> TerminalProfile
Get the profile identifier for this capability set.
Sourcepub fn profile_name(&self) -> Option<&'static str>
pub fn profile_name(&self) -> Option<&'static str>
Get the profile name as a string.
Returns None for detected capabilities (use profile()
to distinguish between profiles).
Sourcepub fn from_profile(profile: TerminalProfile) -> Self
pub fn from_profile(profile: TerminalProfile) -> Self
Create capabilities from a profile identifier.
Sourcepub const fn modern() -> Self
pub const fn modern() -> Self
Modern terminal with all features enabled.
Represents terminals like WezTerm, Alacritty, Ghostty, Kitty, iTerm2. All advanced features are enabled.
Sourcepub const fn xterm_256color() -> Self
pub const fn xterm_256color() -> Self
xterm with 256-color support.
Standard xterm-256color profile with common features. No true color, no sync output, no hyperlinks.
Sourcepub const fn xterm() -> Self
pub const fn xterm() -> Self
Basic xterm with 16 colors only.
Minimal xterm without 256-color or advanced features.
Sourcepub const fn vt100() -> Self
pub const fn vt100() -> Self
VT100 terminal (minimal capabilities).
Classic VT100 with basic cursor control, no colors.
Sourcepub const fn dumb() -> Self
pub const fn dumb() -> Self
Dumb terminal with no capabilities.
Alias for basic() with the Dumb profile identifier.
Sourcepub const fn screen() -> Self
pub const fn screen() -> Self
GNU Screen multiplexer.
Screen with 256 colors but multiplexer-safe settings. Sync output and scroll region disabled for passthrough safety.
Sourcepub const fn tmux() -> Self
pub const fn tmux() -> Self
tmux multiplexer.
tmux with 256 colors and multiplexer detection. Advanced features disabled for passthrough safety.
Sourcepub const fn zellij() -> Self
pub const fn zellij() -> Self
Zellij multiplexer.
Zellij with true color (it has better passthrough than tmux/screen).
Sourcepub const fn windows_console() -> Self
pub const fn windows_console() -> Self
Windows Console Host.
Windows Terminal with good color support but some quirks.
Sourcepub const fn kitty() -> Self
pub const fn kitty() -> Self
Kitty terminal.
Kitty with full feature set including keyboard protocol.
Sourcepub const fn linux_console() -> Self
pub const fn linux_console() -> Self
Linux console (framebuffer console).
Linux console with no colors and basic features.
Sourcepub fn builder() -> CapabilityProfileBuilder
pub fn builder() -> CapabilityProfileBuilder
Create a builder for custom capability profiles.
Start with all capabilities disabled and enable what you need.
Source§impl TerminalCapabilities
impl TerminalCapabilities
Sourcepub fn detect() -> Self
pub fn detect() -> Self
Detect terminal capabilities from the environment.
This examines environment variables to determine what features the current terminal supports. When in doubt, capabilities are disabled for safety.
Sourcepub const fn basic() -> Self
pub const fn basic() -> Self
Create a minimal fallback capability set.
This is safe to use on any terminal, including dumb terminals. All advanced features are disabled.
Sourcepub const fn in_any_mux(&self) -> bool
pub const fn in_any_mux(&self) -> bool
Check if running inside any terminal multiplexer.
This includes tmux, GNU screen, and Zellij.
Sourcepub const fn color_depth(&self) -> &'static str
pub const fn color_depth(&self) -> &'static str
Get the maximum color depth as a string identifier.
Sourcepub const fn use_sync_output(&self) -> bool
pub const fn use_sync_output(&self) -> bool
Whether synchronized output (DEC 2026) should be used.
Disabled in multiplexers because passthrough is unreliable for mode-setting sequences.
Sourcepub const fn use_scroll_region(&self) -> bool
pub const fn use_scroll_region(&self) -> bool
Whether scroll-region optimization (DECSTBM) is safe to use.
Disabled in multiplexers due to inconsistent scroll margin handling across tmux, screen, and Zellij.
Sourcepub const fn use_hyperlinks(&self) -> bool
pub const fn use_hyperlinks(&self) -> bool
Whether OSC 8 hyperlinks should be emitted.
Disabled in tmux and screen because passthrough for OSC sequences is fragile. Zellij (0.39+) has better passthrough but is still disabled by default for safety.
Sourcepub const fn use_clipboard(&self) -> bool
pub const fn use_clipboard(&self) -> bool
Whether OSC 52 clipboard access should be used.
Already gated by mux detection in detect(), but this method
provides a consistent policy interface.
Sourcepub const fn needs_passthrough_wrap(&self) -> bool
pub const fn needs_passthrough_wrap(&self) -> bool
Whether the passthrough wrapping is needed for this environment.
Returns true if running in tmux or screen, which require
DCS passthrough for escape sequences to reach the inner terminal.
Zellij handles passthrough natively and doesn’t need wrapping.
Trait Implementations§
Source§impl Clone for TerminalCapabilities
impl Clone for TerminalCapabilities
Source§fn clone(&self) -> TerminalCapabilities
fn clone(&self) -> TerminalCapabilities
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more