pub struct Window { /* private fields */ }Expand description
A tmux window identity plus one session-specific link and owned snapshot.
Implementations§
Source§impl Window
impl Window
Sourcepub async fn from_environment() -> Result<Self>
pub async fn from_environment() -> Result<Self>
Resolves the window containing the pane named by TMUX_PANE.
Sourcepub const fn link(&self) -> &WindowLink
pub const fn link(&self) -> &WindowLink
Returns this session-specific window link.
Sourcepub const fn session_id(&self) -> SessionId
pub const fn session_id(&self) -> SessionId
Returns the owning session ID.
Sourcepub const fn snapshot(&self) -> &WindowSnapshot
pub const fn snapshot(&self) -> &WindowSnapshot
Returns the owned snapshot.
Sourcepub async fn refresh(&mut self) -> Result<()>
pub async fn refresh(&mut self) -> Result<()>
Refreshes this exact window link. A moved or unlinked row is stale.
Sourcepub async fn linked_sessions(&self) -> Result<Vec<Session>>
pub async fn linked_sessions(&self) -> Result<Vec<Session>>
Resolves every session containing a link to this window.
Sourcepub async fn panes_or_empty(&self) -> Vec<Pane>
pub async fn panes_or_empty(&self) -> Vec<Pane>
Lists panes, returning an empty collection on failure.
Sourcepub async fn active_pane(&self) -> Result<Pane>
pub async fn active_pane(&self) -> Result<Pane>
Returns the active pane.
Sourcepub async fn cmd(&self, command: Command) -> Result<CommandResult>
pub async fn cmd(&self, command: Command) -> Result<CommandResult>
Runs an arbitrary tmux command targeted at this exact link.
Sourcepub async fn split(&self, options: SplitPane) -> Result<Pane>
pub async fn split(&self, options: SplitPane) -> Result<Pane>
Splits this window’s active pane.
Sourcepub async fn new_pane(&self, options: NewPane) -> Result<Pane>
pub async fn new_pane(&self, options: NewPane) -> Result<Pane>
Creates a floating pane in this window. Requires tmux 3.7+.
Sourcepub async fn new_window(
&self,
options: NewWindow,
position: WindowPosition,
) -> Result<Window>
pub async fn new_window( &self, options: NewWindow, position: WindowPosition, ) -> Result<Window>
Creates a window before or after this link.
Sourcepub async fn select_pane(&self, pane: PaneId) -> Result<Pane>
pub async fn select_pane(&self, pane: PaneId) -> Result<Pane>
Selects a pane in this window.
Sourcepub async fn last_pane_with(
&self,
input_enabled: Option<bool>,
keep_zoom: bool,
) -> Result<Pane>
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.
Sourcepub async fn with_pane<F, Fut, T>(
&self,
options: SplitPane,
operation: F,
) -> Result<T>
pub async fn with_pane<F, Fut, T>( &self, options: SplitPane, operation: F, ) -> Result<T>
Creates a temporary pane, runs an async operation, and attempts cleanup.
Sourcepub async fn rename(&mut self, name: impl Into<OsString>) -> Result<()>
pub async fn rename(&mut self, name: impl Into<OsString>) -> Result<()>
Renames the window and refreshes the snapshot.
Sourcepub async fn select_layout(&mut self, layout: &Layout) -> Result<()>
pub async fn select_layout(&mut self, layout: &Layout) -> Result<()>
Applies a built-in or serialized layout.
Sourcepub async fn next_layout(&mut self) -> Result<()>
pub async fn next_layout(&mut self) -> Result<()>
Advances to the next built-in layout and refreshes the snapshot.
Sourcepub async fn previous_layout(&mut self) -> Result<()>
pub async fn previous_layout(&mut self) -> Result<()>
Returns to the previous layout and refreshes the snapshot.
Sourcepub async fn spread_layout(&mut self) -> Result<()>
pub async fn spread_layout(&mut self) -> Result<()>
Spreads panes evenly with select-layout -E.
Sourcepub async fn resize(
&mut self,
width: Option<u32>,
height: Option<u32>,
) -> Result<()>
pub async fn resize( &mut self, width: Option<u32>, height: Option<u32>, ) -> Result<()>
Resizes the window to an absolute width and/or height.
Sourcepub async fn resize_with(&mut self, options: WindowResize) -> Result<()>
pub async fn resize_with(&mut self, options: WindowResize) -> Result<()>
Applies typed adjustment, absolute, expand, or shrink resizing.
Sourcepub async fn rotate_keep_zoom(&self, direction: Rotation) -> Result<()>
pub async fn rotate_keep_zoom(&self, direction: Rotation) -> Result<()>
Rotates panes without unzooming the window.
Sourcepub async fn swap_with(
&self,
destination: impl Into<WindowTarget>,
detached: bool,
) -> Result<()>
pub async fn swap_with( &self, destination: impl Into<WindowTarget>, detached: bool, ) -> Result<()>
Swaps this window with another target.
Sourcepub async fn link_to(
&self,
session: impl Into<SessionTarget>,
index: Option<u32>,
kill_existing: bool,
) -> Result<Window>
pub async fn link_to( &self, session: impl Into<SessionTarget>, index: Option<u32>, kill_existing: bool, ) -> Result<Window>
Links this window into another session and returns the new link snapshot.
Sourcepub async fn link_to_with(
&self,
session: impl Into<SessionTarget>,
index: Option<u32>,
kill_existing: bool,
position: Option<WindowPosition>,
detached: bool,
) -> Result<Window>
pub async fn link_to_with( &self, session: impl Into<SessionTarget>, index: Option<u32>, kill_existing: bool, position: Option<WindowPosition>, detached: bool, ) -> Result<Window>
Links this window with placement and selection flags.
Sourcepub async fn move_to(
&self,
session: impl Into<SessionTarget>,
index: Option<u32>,
kill_existing: bool,
) -> Result<()>
pub async fn move_to( &self, session: impl Into<SessionTarget>, index: Option<u32>, kill_existing: bool, ) -> Result<()>
Moves this link to another destination.
Sourcepub async fn move_to_with(
&self,
session: impl Into<SessionTarget>,
index: Option<u32>,
kill_existing: bool,
position: Option<WindowPosition>,
detached: bool,
) -> Result<()>
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.
Sourcepub async fn unlink(&self, kill_if_last: bool) -> Result<()>
pub async fn unlink(&self, kill_if_last: bool) -> Result<()>
Unlinks this window from its session.
Sourcepub async fn respawn(
&self,
command: Option<OsString>,
cwd: Option<PathBuf>,
kill: bool,
) -> Result<()>
pub async fn respawn( &self, command: Option<OsString>, cwd: Option<PathBuf>, kill: bool, ) -> Result<()>
Respawns the active pane for this window.
Sourcepub async fn respawn_with(&self, options: RespawnWindow) -> Result<()>
pub async fn respawn_with(&self, options: RespawnWindow) -> Result<()>
Respawns a window with typed environment and process arguments.
Sourcepub async fn kill_others(&self) -> Result<()>
pub async fn kill_others(&self) -> Result<()>
Kills every other window in this session.
Sourcepub async fn sparse_options(&self) -> Result<SparseOptionMap>
pub async fn sparse_options(&self) -> Result<SparseOptionMap>
Shows sparse window options and hooks.
Sourcepub async fn set_option(
&self,
name: &str,
value: &OptionValue,
append: bool,
) -> Result<()>
pub async fn set_option( &self, name: &str, value: &OptionValue, append: bool, ) -> Result<()>
Sets a window option.
Sourcepub async fn unset_option(&self, name: &str) -> Result<()>
pub async fn unset_option(&self, name: &str) -> Result<()>
Unsets a window option.