On this page
freeze.freeze
- Module
- freeze
- Package
- libtmux
- Source
- crates/tmux-workspace/src/freeze.rs
-
Describe a live session as a workspace.
The result is a [
Workspace], so it can be rendered withWorkspace::to_yamlor handed straight back tocrate::WorkspaceBuilderto make another like it.A pane is described by the command tmux says it is running. For a pane sitting at a shell that is the shell itself, which would restart as an empty pane -- correct, and rarely what was meant. Panes running something are the ones worth freezing.
Errors
Returns an error when the session's windows or panes cannot be listed.
Examples
use libtmux::{SplitDirection, SplitOptions}; use tmux_workspace::freeze; let guard = libtmux::test::TestServer::new().await?; let session = guard.server().new_session("built-by-hand").await?; let mut window = session.active_window().await?.expect("a window"); window.split(SplitOptions::new(SplitDirection::Below)).await?; let workspace = freeze(&session).await?; assert_eq!(workspace.session_name, "built-by-hand"); assert_eq!(workspace.windows.len(), 1); assert_eq!(workspace.windows[0].panes.len(), 2); // And it round-trips through the file format. let yaml = workspace.to_yaml(); assert_eq!(tmux_workspace::Workspace::from_yaml(&yaml)?, workspace); guard.shutdown().await?;
0 declared, 0 inherited