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

View as Markdown

Module
server
Declared in
Server
Package
libtmux
Source
packages/libtmux/src/server.ts
Other languages
PythonRubyLuaRustGoJava.NETC++Swift
sessions ( ) → Promise<Selection<Session>>
methodasync [source]
methodasync [source]
sessions

Every session on the server, read now.

This and its three siblings each take a snapshot of their own — one daemon identity read and four listings per call — so calling several in a row describes several different instants and pays for each. Inside a loop that is an N+1: prefer one snapshot and read sessions , windows , panes , and clients off it, which is both cheaper and consistent.

Discussed in Traversal

In other ports List the server’s sessions

Examples

// 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();
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?;

0 declared, 0 inherited

Esc

Type to search.