freeze.freeze
-
Describe a live session as a workspace.
Description#
The result is a
Workspace, so it can be rendered withWorkspace::to_yaml()or handed straight back tocrate::WorkspaceBuilderto make another like it.A pane is described by the command tmux says it is running, by name and without its arguments. A pane at its shell's prompt freezes to a pane with no command: tmux reports the shell itself, and recording it would start a shell inside a shell when the file is built. A shell is the session's
default-shell, or a common interactive shell by name.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?;
Guides#
Pages that discuss freeze.
In other ports#
Export a live session as workspace data
| Language | Equivalent |
|---|---|
| Python | tmuxp |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | the workspace package applies descriptions but does not export live sessions |
| Go | the workspace module builds descriptions but has no live-session export |
| Java | the workspace module builds descriptions but has no live-session export |
| C# | the workspace package builds descriptions but has no live-session export |
| C++ | the source-only workspace consumer builds descriptions but has no live-session export |
| Swift | encoding a Workspace serializes an existing description; it does not read a live session |
| OCaml | The workspace packages validate and apply descriptions; they do not export a live session as configuration. |
| Perl | The JSON workspace distribution validates, plans and loads configurations; live-session export is outside the selected scope. |
No equivalent is recorded in Ruby, Lua, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.