Skip to main content

Window

Struct Window 

Source
pub struct Window { /* private fields */ }
Expand description

A tmux window identity plus one session-specific link and owned snapshot.

Implementations§

Source§

impl Window

Source

pub async fn display(&self, options: DisplayMessage) -> Result<Option<TmuxText>>

Displays or evaluates a message in this window’s context.

Source§

impl Window

Source

pub async fn from_environment() -> Result<Self>

Resolves the window containing the pane named by TMUX_PANE.

Source

pub const fn id(&self) -> WindowId

Returns the immutable window ID.

Returns this session-specific window link.

Source

pub const fn session_id(&self) -> SessionId

Returns the owning session ID.

Source

pub const fn snapshot(&self) -> &WindowSnapshot

Returns the owned snapshot.

Source

pub const fn server(&self) -> &Server

Returns the server handle.

Source

pub async fn refresh(&mut self) -> Result<()>

Refreshes this exact window link. A moved or unlinked row is stale.

Source

pub async fn session(&self) -> Result<Session>

Resolves the parent session.

Source

pub async fn linked_sessions(&self) -> Result<Vec<Session>>

Resolves every session containing a link to this window.

Source

pub async fn panes(&self) -> Result<Vec<Pane>>

Lists panes in this window.

Source

pub async fn panes_or_empty(&self) -> Vec<Pane>

Lists panes, returning an empty collection on failure.

Source

pub async fn active_pane(&self) -> Result<Pane>

Returns the active pane.

Source

pub async fn cmd(&self, command: Command) -> Result<CommandResult>

Runs an arbitrary tmux command targeted at this exact link.

Source

pub async fn split(&self, options: SplitPane) -> Result<Pane>

Splits this window’s active pane.

Source

pub async fn new_pane(&self, options: NewPane) -> Result<Pane>

Creates a floating pane in this window. Requires tmux 3.7+.

Source

pub async fn new_window( &self, options: NewWindow, position: WindowPosition, ) -> Result<Window>

Creates a window before or after this link.

Source

pub async fn select_pane(&self, pane: PaneId) -> Result<Pane>

Selects a pane in this window.

Source

pub async fn last_pane(&self) -> Result<Pane>

Selects the last active pane.

Source

pub async fn last_pane_with( &self, input_enabled: Option<bool>, keep_zoom: bool, ) -> Result<Pane>

Selects the last active pane with explicit input and zoom behavior.

Source

pub async fn with_pane<F, Fut, T>( &self, options: SplitPane, operation: F, ) -> Result<T>
where F: FnOnce(Pane) -> Fut, Fut: Future<Output = Result<T>>,

Creates a temporary pane, runs an async operation, and attempts cleanup.

Source

pub async fn select(&self) -> Result<()>

Selects this window link.

Source

pub async fn rename(&mut self, name: impl Into<OsString>) -> Result<()>

Renames the window and refreshes the snapshot.

Source

pub async fn select_layout(&mut self, layout: &Layout) -> Result<()>

Applies a built-in or serialized layout.

Source

pub async fn next_layout(&mut self) -> Result<()>

Advances to the next built-in layout and refreshes the snapshot.

Source

pub async fn previous_layout(&mut self) -> Result<()>

Returns to the previous layout and refreshes the snapshot.

Source

pub async fn spread_layout(&mut self) -> Result<()>

Spreads panes evenly with select-layout -E.

Source

pub async fn resize( &mut self, width: Option<u32>, height: Option<u32>, ) -> Result<()>

Resizes the window to an absolute width and/or height.

Source

pub async fn resize_with(&mut self, options: WindowResize) -> Result<()>

Applies typed adjustment, absolute, expand, or shrink resizing.

Source

pub async fn rotate(&self, direction: Rotation) -> Result<()>

Rotates panes in the window.

Source

pub async fn rotate_keep_zoom(&self, direction: Rotation) -> Result<()>

Rotates panes without unzooming the window.

Source

pub async fn swap_with( &self, destination: impl Into<WindowTarget>, detached: bool, ) -> Result<()>

Swaps this window with another target.

Links this window into another session and returns the new link snapshot.

Links this window with placement and selection flags.

Source

pub async fn move_to( &self, session: impl Into<SessionTarget>, index: Option<u32>, kill_existing: bool, ) -> Result<()>

Moves this link to another destination.

Source

pub async fn move_to_with( &self, session: impl Into<SessionTarget>, index: Option<u32>, kill_existing: bool, position: Option<WindowPosition>, detached: bool, ) -> Result<()>

Moves this window with placement and selection flags.

Unlinks this window from its session.

Source

pub async fn respawn( &self, command: Option<OsString>, cwd: Option<PathBuf>, kill: bool, ) -> Result<()>

Respawns the active pane for this window.

Source

pub async fn respawn_with(&self, options: RespawnWindow) -> Result<()>

Respawns a window with typed environment and process arguments.

Source

pub async fn kill(&self) -> Result<()>

Destroys the underlying window and all of its links.

Source

pub async fn kill_others(&self) -> Result<()>

Kills every other window in this session.

Source

pub async fn options(&self) -> Result<OptionMap>

Shows window-scoped options.

Source

pub async fn sparse_options(&self) -> Result<SparseOptionMap>

Shows sparse window options and hooks.

Source

pub async fn set_option( &self, name: &str, value: &OptionValue, append: bool, ) -> Result<()>

Sets a window option.

Source

pub async fn unset_option(&self, name: &str) -> Result<()>

Unsets a window option.

Trait Implementations§

Source§

impl Clone for Window

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Window

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Window

Source§

impl PartialEq for Window

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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