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.

enum libtmux-rs latest

WindowPlacement

Where a new window goes, relative to the index it is given.

Source and package
Qualified name
libtmux::session::WindowPlacement
Module
session
Package
libtmux
Source
crates/libtmux/src/session.rs
enum session.WindowPlacement

Description#

Without one, tmux takes the first free index.

Examples#

use libtmux::{NewWindowOptions, WindowPlacement};
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("work").await?;
let first = session.active_window().await?.expect("a session has a window");
// Inserting before an index shifts the windows already at or after it, so
// the index a caller holds is only good until the next insert.
let inserted = session
.new_window(
NewWindowOptions::new("inserted")
.index(first.index())
.placement(WindowPlacement::Before),
)
.await?;
assert!(inserted.index() <= first.index());
guard.shutdown().await?;

Variants2#

WindowPlacement variants
CasePayloadDescription
After No payload Insert after it.
Before No payload Insert before the target index, shifting later windows along.
Esc

Type to search.

Reference previewOpen reference