pub struct Tab {Show 37 fields
pub id: TabId,
pub terminal: Arc<Mutex<TerminalManager>>,
pub pane_manager: Option<PaneManager>,
pub title: String,
pub has_activity: bool,
pub scroll_state: ScrollState,
pub mouse: MouseState,
pub bell: BellState,
pub cache: RenderCache,
pub refresh_task: Option<JoinHandle<()>>,
pub working_directory: Option<String>,
pub custom_color: Option<[u8; 3]>,
pub has_default_title: bool,
pub last_activity_time: Instant,
pub last_seen_generation: u64,
pub anti_idle_last_activity: Instant,
pub anti_idle_last_generation: u64,
pub silence_notified: bool,
pub exit_notified: bool,
pub session_logger: SharedSessionLogger,
pub tmux_gateway_active: bool,
pub tmux_pane_id: Option<TmuxPaneId>,
pub detected_hostname: Option<String>,
pub detected_cwd: Option<String>,
pub auto_applied_profile_id: Option<ProfileId>,
pub auto_applied_dir_profile_id: Option<ProfileId>,
pub profile_icon: Option<String>,
pub pre_profile_title: Option<String>,
pub badge_override: Option<String>,
pub coprocess_ids: Vec<Option<CoprocessId>>,
pub script_manager: ScriptManager,
pub script_ids: Vec<Option<ScriptId>>,
pub script_observer_ids: Vec<Option<ObserverId>>,
pub script_forwarders: Vec<Option<Arc<ScriptEventForwarder>>>,
pub trigger_marks: Vec<ScrollbackMark>,
pub pre_ssh_switch_profile: Option<ProfileId>,
pub ssh_auto_switched: bool,
/* private fields */
}Expand description
A single terminal tab with its own state (supports split panes)
Fields§
§id: TabIdUnique identifier for this tab
terminal: Arc<Mutex<TerminalManager>>The terminal session for this tab (legacy - use pane_manager for new code)
pane_manager: Option<PaneManager>Pane manager for split pane support
title: StringTab title (from OSC sequences or fallback)
has_activity: boolWhether this tab has unread activity since last viewed
scroll_state: ScrollStateScroll state for this tab (legacy - each pane has its own)
mouse: MouseStateMouse state for this tab (legacy - each pane has its own)
bell: BellStateBell state for this tab (legacy - each pane has its own)
cache: RenderCacheRender cache for this tab (legacy - each pane has its own)
refresh_task: Option<JoinHandle<()>>Async task for refresh polling
working_directory: Option<String>Working directory when tab was created (for inheriting)
custom_color: Option<[u8; 3]>Custom tab color [R, G, B] (0-255), overrides config colors when set
has_default_title: boolWhether the tab has its default “Tab N” title (not set by OSC, CWD, or user)
last_activity_time: InstantLast time terminal output (activity) was detected
last_seen_generation: u64Last terminal update generation seen (to detect new output)
anti_idle_last_activity: InstantLast activity time for anti-idle keep-alive
anti_idle_last_generation: u64Last terminal generation recorded for anti-idle tracking
silence_notified: boolWhether silence notification has been sent for current idle period
exit_notified: boolWhether exit notification has been sent for this tab
session_logger: SharedSessionLoggerSession logger for automatic session recording
tmux_gateway_active: boolWhether this tab is in tmux gateway mode
tmux_pane_id: Option<TmuxPaneId>The tmux pane ID this tab represents (when in gateway mode)
detected_hostname: Option<String>Last detected hostname for automatic profile switching (from OSC 7)
detected_cwd: Option<String>Last detected CWD for automatic profile switching (from OSC 7)
auto_applied_profile_id: Option<ProfileId>Profile ID that was auto-applied based on hostname detection
auto_applied_dir_profile_id: Option<ProfileId>Profile ID that was auto-applied based on directory pattern matching
profile_icon: Option<String>Icon from auto-applied profile (displayed in tab bar)
pre_profile_title: Option<String>Original tab title saved before auto-profile override (restored when profile clears)
badge_override: Option<String>Badge text override from auto-applied profile (overrides global badge_format)
coprocess_ids: Vec<Option<CoprocessId>>Mapping from config index to coprocess ID (for UI tracking)
script_manager: ScriptManagerScript manager for this tab
script_ids: Vec<Option<ScriptId>>Maps config index to ScriptId for running scripts
script_observer_ids: Vec<Option<ObserverId>>Observer IDs registered with the terminal for script event forwarding
script_forwarders: Vec<Option<Arc<ScriptEventForwarder>>>Event forwarders (shared with observer registration)
trigger_marks: Vec<ScrollbackMark>Trigger-generated scrollbar marks (from MarkLine actions)
pre_ssh_switch_profile: Option<ProfileId>Profile saved before SSH auto-switch (for revert on disconnect)
ssh_auto_switched: boolWhether current profile was auto-applied due to SSH hostname detection
Implementations§
Source§impl Tab
impl Tab
Sourcepub fn new(
id: TabId,
tab_number: usize,
config: &Config,
runtime: Arc<Runtime>,
working_directory: Option<String>,
grid_size: Option<(usize, usize)>,
) -> Result<Self>
pub fn new( id: TabId, tab_number: usize, config: &Config, runtime: Arc<Runtime>, working_directory: Option<String>, grid_size: Option<(usize, usize)>, ) -> Result<Self>
Create a new tab with a terminal session
§Arguments
id- Unique tab identifiertab_number- Display number for the tab (1-indexed)config- Terminal configurationruntime- Tokio runtime for async operationsworking_directory- Optional working directory to start ingrid_size- Optional (cols, rows) override. When provided, uses these dimensions instead of config.cols/rows. This ensures the shell starts with the correct dimensions when the renderer has already calculated the grid size accounting for tab bar height.
Sourcepub fn new_from_profile(
id: TabId,
config: &Config,
_runtime: Arc<Runtime>,
profile: &Profile,
grid_size: Option<(usize, usize)>,
) -> Result<Self>
pub fn new_from_profile( id: TabId, config: &Config, _runtime: Arc<Runtime>, profile: &Profile, grid_size: Option<(usize, usize)>, ) -> Result<Self>
Create a new tab from a profile configuration
The profile can override:
- Working directory
- Command and arguments (instead of default shell)
- Tab name
If a profile specifies a command, it always runs from the profile’s working directory (or config default if unset).
§Arguments
id- Unique tab identifierconfig- Terminal configuration_runtime- Tokio runtime (unused but kept for API consistency)profile- Profile configuration to usegrid_size- Optional (cols, rows) override for initial terminal size
Sourcepub fn is_bell_active(&self) -> bool
pub fn is_bell_active(&self) -> bool
Check if the visual bell is currently active (within flash duration)
Sourcepub fn update_title(&mut self)
pub fn update_title(&mut self)
Update tab title from terminal OSC sequences
Sourcepub fn set_default_title(&mut self, tab_number: usize)
pub fn set_default_title(&mut self, tab_number: usize)
Set the tab’s default title based on its position
Sourcepub fn set_title(&mut self, title: &str)
pub fn set_title(&mut self, title: &str)
Explicitly set the tab title (for tmux window names, etc.)
This overrides any default title and marks the tab as having a custom title.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the terminal in this tab is still running
Sourcepub fn restore_pane_layout(
&mut self,
layout: &SessionPaneNode,
config: &Config,
runtime: Arc<Runtime>,
)
pub fn restore_pane_layout( &mut self, layout: &SessionPaneNode, config: &Config, runtime: Arc<Runtime>, )
Restore a pane layout from a saved session
Replaces the current single-pane layout with a saved pane tree. Each leaf in the tree gets a new terminal session with the saved CWD. If the build fails, the tab keeps its existing single pane.
Sourcepub fn parse_hostname_from_osc7_url(url: &str) -> Option<String>
pub fn parse_hostname_from_osc7_url(url: &str) -> Option<String>
Parse hostname from an OSC 7 file:// URL
OSC 7 format: file://hostname/path or file:///path (localhost)
Returns the hostname if present and not localhost, None otherwise.
Sourcepub fn check_hostname_change(&mut self) -> Option<String>
pub fn check_hostname_change(&mut self) -> Option<String>
Check if hostname has changed and update tracking
Returns Some(hostname) if a new remote hostname was detected, None if hostname hasn’t changed or is local.
This uses the hostname extracted from OSC 7 sequences by the terminal emulator.
Sourcepub fn check_cwd_change(&mut self) -> Option<String>
pub fn check_cwd_change(&mut self) -> Option<String>
Check if CWD has changed and update tracking
Returns Some(cwd) if the CWD has changed, None otherwise. Uses the CWD reported via OSC 7 by the terminal emulator.
Sourcepub fn clear_auto_profile(&mut self)
pub fn clear_auto_profile(&mut self)
Clear auto-applied profile tracking
Call this when manually switching profiles or when the hostname returns to local, or when disconnecting from tmux.
Sourcepub fn start_refresh_task(
&mut self,
runtime: Arc<Runtime>,
window: Arc<Window>,
max_fps: u32,
)
pub fn start_refresh_task( &mut self, runtime: Arc<Runtime>, window: Arc<Window>, max_fps: u32, )
Start the refresh polling task for this tab
Sourcepub fn stop_refresh_task(&mut self)
pub fn stop_refresh_task(&mut self)
Stop the refresh polling task
Sourcepub fn set_custom_color(&mut self, color: [u8; 3])
pub fn set_custom_color(&mut self, color: [u8; 3])
Set a custom color for this tab
Sourcepub fn clear_custom_color(&mut self)
pub fn clear_custom_color(&mut self)
Clear the custom color for this tab (reverts to default config colors)
Sourcepub fn has_custom_color(&self) -> bool
pub fn has_custom_color(&self) -> bool
Check if this tab has a custom color set
Sourcepub fn toggle_session_logging(&mut self, config: &Config) -> Result<bool>
pub fn toggle_session_logging(&mut self, config: &Config) -> Result<bool>
Toggle session logging on/off.
Returns Ok(true) if logging is now active, Ok(false) if stopped.
If logging wasn’t active and no logger exists, creates a new one.
Sourcepub fn is_session_logging_active(&self) -> bool
pub fn is_session_logging_active(&self) -> bool
Check if session logging is currently active.
Sourcepub fn has_multiple_panes(&self) -> bool
pub fn has_multiple_panes(&self) -> bool
Check if this tab has multiple panes (split)
Sourcepub fn pane_count(&self) -> usize
pub fn pane_count(&self) -> usize
Get the number of panes in this tab
Sourcepub fn split_horizontal(
&mut self,
config: &Config,
runtime: Arc<Runtime>,
dpi_scale: f32,
) -> Result<Option<PaneId>>
pub fn split_horizontal( &mut self, config: &Config, runtime: Arc<Runtime>, dpi_scale: f32, ) -> Result<Option<PaneId>>
Split the current pane horizontally (panes stacked vertically)
Returns the new pane ID if successful.
dpi_scale converts logical pixel config values to physical pixels.
Sourcepub fn split_vertical(
&mut self,
config: &Config,
runtime: Arc<Runtime>,
dpi_scale: f32,
) -> Result<Option<PaneId>>
pub fn split_vertical( &mut self, config: &Config, runtime: Arc<Runtime>, dpi_scale: f32, ) -> Result<Option<PaneId>>
Split the current pane vertically (panes side by side)
Returns the new pane ID if successful.
dpi_scale converts logical pixel config values to physical pixels.
Sourcepub fn close_focused_pane(&mut self) -> bool
pub fn close_focused_pane(&mut self) -> bool
Close the focused pane
Returns true if this was the last pane (tab should close)
Sourcepub fn close_exited_panes(&mut self) -> (Vec<PaneId>, bool)
pub fn close_exited_panes(&mut self) -> (Vec<PaneId>, bool)
Check for exited panes and close them
Returns (closed_pane_ids, tab_should_close) where:
closed_pane_ids: Vec of pane IDs that were closedtab_should_close: true if all panes have exited (tab should close)
Sourcepub fn pane_manager(&self) -> Option<&PaneManager>
pub fn pane_manager(&self) -> Option<&PaneManager>
Get the pane manager if split panes are enabled
Sourcepub fn pane_manager_mut(&mut self) -> Option<&mut PaneManager>
pub fn pane_manager_mut(&mut self) -> Option<&mut PaneManager>
Get mutable access to the pane manager
Sourcepub fn init_pane_manager(&mut self)
pub fn init_pane_manager(&mut self)
Initialize the pane manager if not already present
This is used for tmux integration where we need to create the pane manager before applying a layout.
Sourcepub fn set_pane_bounds(
&mut self,
bounds: PaneBounds,
cell_width: f32,
cell_height: f32,
)
pub fn set_pane_bounds( &mut self, bounds: PaneBounds, cell_width: f32, cell_height: f32, )
Set the pane bounds and resize terminals
This should be called before creating splits to ensure panes are sized correctly. If the pane manager doesn’t exist yet, this creates it with the bounds set.
Sourcepub fn set_pane_bounds_with_padding(
&mut self,
bounds: PaneBounds,
cell_width: f32,
cell_height: f32,
padding: f32,
)
pub fn set_pane_bounds_with_padding( &mut self, bounds: PaneBounds, cell_width: f32, cell_height: f32, padding: f32, )
Set the pane bounds and resize terminals with padding
This should be called before creating splits to ensure panes are sized correctly. The padding parameter accounts for content inset from pane edges.
Sourcepub fn focus_pane_at(&mut self, x: f32, y: f32) -> Option<PaneId>
pub fn focus_pane_at(&mut self, x: f32, y: f32) -> Option<PaneId>
Focus the pane at the given pixel coordinates
Returns the ID of the newly focused pane, or None if no pane at that position
Sourcepub fn focused_pane_id(&self) -> Option<PaneId>
pub fn focused_pane_id(&self) -> Option<PaneId>
Get the ID of the currently focused pane
Sourcepub fn is_pane_focused(&self, pane_id: PaneId) -> bool
pub fn is_pane_focused(&self, pane_id: PaneId) -> bool
Check if a specific pane is focused
Navigate to an adjacent pane
Sourcepub fn is_on_divider(&self, x: f32, y: f32) -> bool
pub fn is_on_divider(&self, x: f32, y: f32) -> bool
Check if a position is on a divider
Sourcepub fn find_divider_at(&self, x: f32, y: f32) -> Option<usize>
pub fn find_divider_at(&self, x: f32, y: f32) -> Option<usize>
Find divider at position
Returns the divider index if found
Sourcepub fn get_divider(&self, index: usize) -> Option<DividerRect>
pub fn get_divider(&self, index: usize) -> Option<DividerRect>
Get divider info by index
Sourcepub fn drag_divider(&mut self, divider_index: usize, x: f32, y: f32)
pub fn drag_divider(&mut self, divider_index: usize, x: f32, y: f32)
Drag a divider to a new position
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tab
impl !RefUnwindSafe for Tab
impl Send for Tab
impl Sync for Tab
impl Unpin for Tab
impl UnsafeUnpin for Tab
impl !UnwindSafe for Tab
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more