# window.Window.select_layout

- **Module:** window.Window
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/window.rs#L457
- **Page:** https://libtmux.org/reference/rs/window-window-select_layout/

```
window.Window.select_layout(mut, layout: impl Into<LayoutSpec>) -> Result<&mut Self, Error>
```

Set the window's pane layout.

Takes a [`Layout`] tmux knows by name, or a layout string tmux itself
produced through [`LayoutSpec::Saved`]. A `&str`, `String`, or
`OsString` is read as a saved layout, so a caller who already had one
keeps working.

# Errors

Returns an error when tmux refuses the layout, and
[`crate::ErrorKind::UnsupportedVersion`] when a named layout needs a
newer tmux than this endpoint runs. See [`Layout::minimum_release`].

## Example

```rust
use libtmux::Layout;

let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("arranged").await?;
let mut window = session.active_window().await?.expect("a window");

window.select_layout(Layout::Tiled).await?;

guard.shutdown().await?;
```
