Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-rs latest

Window.select_layout

Set the window's pane layout.

Source and package
Qualified name
libtmux::window::Window::select_layout
Module
window
Declared in
Window
Package
libtmux
Source
crates/libtmux/src/window.rs
Other languages
Perlmethod Erlang PowerShell Julia Elixir Haskell Common Lisp PythonRubyLuaTypeScriptGoJavaC#C++Swift Kotlin Scala OCaml F# Clojure
pub async fn select_layout( &mut self, layout: impl Into<LayoutSpec>, ) -> Result<&mut Self, Error>

Description#

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. Strings also accept unique named-layout abbreviations. Checksums and nonempty trees are checked before dispatch; tmux owns geometry correction and pruning. Nesting is limited to 256 groups.

Errors

Returns Error::InvalidLayout for unsafe syntax or an ambiguous name, 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().

Examples#

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?;
Parameters

tmux command#

The tmux commands behind select_layout.

tmux C API#

The C declarations in tmux that implement these commands.

In other ports#

Set a window's pane layout

Equivalents of Set a window's pane layout in other languages
Language Equivalent
Python libtmux.Window.select_layout
Ruby LibTmux::Window#select_layout
Lua libtmux.Window:layout
Erlang tmux_window:select_layout/2
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript window.Window.selectLayout
Go tmux.Window.SelectLayout
Java io.github.libtmux.Window.selectLayout
C# LibTmux.Window.SelectLayoutAsync
C++ libtmux::Window::select_layout
Swift Server.selectLayout(_:_:)
OCaml Libtmux_unix.Client.select_layout
Perl LibTmux::Server::select_layout Explicit Server operation. Captured entities remain local observations; use a new snapshot to observe changes.

No equivalent is recorded in PowerShell, Julia, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Esc

Type to search.

Reference previewOpen reference