Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Rust API

Rust documentation

View as Markdown

Module
server
Declared in
Server
Package
libtmux
Source
crates/libtmux/src/server/discovery.rs
Other languages
PythonTypeScriptGoJava.NETC++Swift
sessions ( self ) → Result<Vec<Session>, Error>
method [source]
method [source]
sessions

List every session on the server, preserving any failure.

Errors

Returns an error when the list command cannot run, or when its output cannot be decoded into snapshots.

Discussed in Traversal

In other ports List the server’s sessions

Examples

let guard = libtmux::test::TestServer::new().await?;
guard.session("work").await?;
let sessions = guard.server().sessions().await?;
assert_eq!(sessions.len(), 1);
assert!(sessions[0].id().to_string().starts_with('$'));
guard.shutdown().await?;
// One invocation, and every collection agrees with the others.
const now = await server.snapshot();
for (const session of now.sessions) console.log(session.name, session.windows.length);
const sessions = await server.sessions();
sessions.where({ name: "work" }).count();

0 declared, 0 inherited

Esc

Type to search.