window.LayoutSpec
Rust
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- window
- Package
- libtmux
- Source
- crates/libtmux/src/window.rs
-
What to arrange a window's panes as.
A
Layoutnames an arrangement tmux computes. A saved string is one tmux already computed:Window::layoutreports one, and handing it back restores the pane sizes, which a named layout cannot express.From
crate::since::JSON_LAYOUTS(3.8) a saved string carries each pane's id, so the restored arrangement is byte-exact, process for process. Below that release the classic checksum-prefixed string carries only sizes and positions: the shape returns, but which pane lands in which cell depends on whether the live pane list happens to already be in the saved cell order, which a mirrored or otherwise asymmetric layout can defeat. A saved string from 3.8+ is refused below it withcrate::ErrorKind::UnsupportedVersion, and a value that is none of a preset name, a classic string, or JSON withcrate::ErrorKind::InvalidInput, both before dispatch.Examples
use libtmux::Layout;let guard = libtmux::test::TestServer::new().await?;let session = guard.server().new_session("restored").await?;let mut window = session.active_window().await?.expect("a window");// Keep what tmux reports, rearrange, then put it back exactly.let before = window.layout().to_owned();window.select_layout(Layout::EvenVertical).await?;window.select_layout(&before).await?;assert_eq!(window.layout().as_bytes(), before.as_bytes());guard.shutdown().await?;
2 declared, 0 inherited