libtmux Reference MCP Search
On this page

io.github.libtmux.Server.Server.sessions

View as Markdown

Module
io.github.libtmux.Server
Declared in
Server
Package
io.github.libtmux:libtmux
Source
libtmux/src/main/java/io/github/libtmux/Server.java
Other languages
PythonTypeScriptRustGo.NETC++Swift
sessions ( ) List<Session>
method [source]
method [source]
sessions

Every session, captured now.

<p>Lenient, by the libtmux contract these accessors have always had: a tmux failure produces an empty list rather than raising, because "no sessions" is the ordinary answer and callers mostly cannot act on the difference. Those that can use #snapshot() , which is strict.

Discussed in Traversal

In other languages 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.