Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

window.LayoutSpec

Rust
  • Python Unavailable
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

View as Markdown

Module
window
Package
libtmux
Source
crates/libtmux/src/window.rs
enum window.LayoutSpec
enumoverload [source]
enumoverload [source]
enum window.LayoutSpec

What to arrange a window's panes as.

A Layout names an arrangement tmux computes. A saved string is one tmux already computed: Window::layout reports 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 with crate::ErrorKind::UnsupportedVersion , and a value that is none of a preset name, a classic string, or JSON with crate::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

Members

  • Named constant An arrangement tmux knows by name.
  • Saved constant A layout string tmux produced, restoring pane sizes exactly.
Esc

Type to search.