- Module
- window
- Declared in
- Window
- Package
- libtmux
- Source
- packages/libtmux/src/window.ts
- Other languages
- PythonRubyLuaRustGoJava.NETC++Swift
-
Apply a named or custom layout.
Applying any layout while a pane is zoomed unzooms the window first — tmux's own behavior, not this method's.
A
window_layoutsaved earlier and passed back here is not guaranteed to put every pane back where it was. Before tmux 3.8, the classic layout string restores the arrangement's shape but can rotate which pane lands in which position; a JSON layout (3.8+, and only for a reader that actually receives JSON — seeServer.connect) restores exactly.Only a preset name, a layout string that parses here, or JSON on tmux 3.8+ is accepted: anything else is refused rather than sent, because two ranges of tmux exit on a layout they cannot read and take every session on the socket with them. tmux 3.3 and 3.3a die on a value with no readable checksum, and 3.7 through 3.7d on one whose checksum is correct and whose cells are not — so the checksum alone is not evidence, and the layout is parsed in full before dispatch.
- Raises
-
-
TypeError – when
layoutis ambiguous, or is neither a preset nor a layout string this package can parse. -
VersionTooLowError – when
layoutnames a mirrored preset or JSON layout the running tmux is too old to apply.
-
In other ports Set a window's pane layout
- Python
libtmux.Window.select_layout - Ruby
LibTmux::Window#select_layout - Lua
libtmux.Window:layout - Rust
window.Window.select_layout - Go
tmux.Window.SelectLayout - Java
io.github.libtmux.Window.Window.selectLayout - .NET
LibTmux.Window.SelectLayoutAsync - C++
libtmux::Window::select_layout - Swift
Server.selectLayout(_:_:)
Examples
await window.selectLayout("even-horizontal");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?;0 declared, 0 inherited