# window.LayoutSpec

- **Module:** window
- **Package:** libtmux
- **Language:** Rust
- **Kind:** enum
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/window.rs#L1413
- **Page:** https://libtmux.org/en/rs/latest/reference/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.

## Example

```rust
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?;
```

## Members

- `Named` (constant): An arrangement tmux knows by name.
- `Saved` (constant): A layout string tmux produced, restoring pane sizes exactly.
