Skip to main content

Tab

Struct Tab 

Source
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: TabId

Unique 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: String

Tab title (from OSC sequences or fallback)

§has_activity: bool

Whether this tab has unread activity since last viewed

§scroll_state: ScrollState

Scroll state for this tab (legacy - each pane has its own)

§mouse: MouseState

Mouse state for this tab (legacy - each pane has its own)

§bell: BellState

Bell state for this tab (legacy - each pane has its own)

§cache: RenderCache

Render 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: bool

Whether the tab has its default “Tab N” title (not set by OSC, CWD, or user)

§last_activity_time: Instant

Last time terminal output (activity) was detected

§last_seen_generation: u64

Last terminal update generation seen (to detect new output)

§anti_idle_last_activity: Instant

Last activity time for anti-idle keep-alive

§anti_idle_last_generation: u64

Last terminal generation recorded for anti-idle tracking

§silence_notified: bool

Whether silence notification has been sent for current idle period

§exit_notified: bool

Whether exit notification has been sent for this tab

§session_logger: SharedSessionLogger

Session logger for automatic session recording

§tmux_gateway_active: bool

Whether 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: ScriptManager

Script 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: bool

Whether current profile was auto-applied due to SSH hostname detection

Implementations§

Source§

impl Tab

Source

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 identifier
  • tab_number - Display number for the tab (1-indexed)
  • config - Terminal configuration
  • runtime - Tokio runtime for async operations
  • working_directory - Optional working directory to start in
  • grid_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.
Source

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 identifier
  • config - Terminal configuration
  • _runtime - Tokio runtime (unused but kept for API consistency)
  • profile - Profile configuration to use
  • grid_size - Optional (cols, rows) override for initial terminal size
Source

pub fn is_bell_active(&self) -> bool

Check if the visual bell is currently active (within flash duration)

Source

pub fn update_title(&mut self)

Update tab title from terminal OSC sequences

Source

pub fn set_default_title(&mut self, tab_number: usize)

Set the tab’s default title based on its position

Source

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.

Source

pub fn is_running(&self) -> bool

Check if the terminal in this tab is still running

Source

pub fn get_cwd(&self) -> Option<String>

Get the current working directory of this tab’s shell

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn start_refresh_task( &mut self, runtime: Arc<Runtime>, window: Arc<Window>, max_fps: u32, )

Start the refresh polling task for this tab

Source

pub fn stop_refresh_task(&mut self)

Stop the refresh polling task

Source

pub fn set_custom_color(&mut self, color: [u8; 3])

Set a custom color for this tab

Source

pub fn clear_custom_color(&mut self)

Clear the custom color for this tab (reverts to default config colors)

Source

pub fn has_custom_color(&self) -> bool

Check if this tab has a custom color set

Source

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.

Source

pub fn is_session_logging_active(&self) -> bool

Check if session logging is currently active.

Source

pub fn has_multiple_panes(&self) -> bool

Check if this tab has multiple panes (split)

Source

pub fn pane_count(&self) -> usize

Get the number of panes in this tab

Source

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.

Source

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.

Source

pub fn close_focused_pane(&mut self) -> bool

Close the focused pane

Returns true if this was the last pane (tab should close)

Source

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 closed
  • tab_should_close: true if all panes have exited (tab should close)
Source

pub fn pane_manager(&self) -> Option<&PaneManager>

Get the pane manager if split panes are enabled

Source

pub fn pane_manager_mut(&mut self) -> Option<&mut PaneManager>

Get mutable access to the pane manager

Source

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.

Source

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.

Source

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.

Source

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

Source

pub fn focused_pane_id(&self) -> Option<PaneId>

Get the ID of the currently focused pane

Source

pub fn is_pane_focused(&self, pane_id: PaneId) -> bool

Check if a specific pane is focused

Source

pub fn navigate_pane(&mut self, direction: NavigationDirection)

Navigate to an adjacent pane

Source

pub fn is_on_divider(&self, x: f32, y: f32) -> bool

Check if a position is on a divider

Source

pub fn find_divider_at(&self, x: f32, y: f32) -> Option<usize>

Find divider at position

Returns the divider index if found

Source

pub fn get_divider(&self, index: usize) -> Option<DividerRect>

Get divider info by index

Source

pub fn drag_divider(&mut self, divider_index: usize, x: f32, y: f32)

Drag a divider to a new position

Trait Implementations§

Source§

impl Drop for Tab

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,