libtmux Reference MCP Search
On this page

Server.sessions()

View as Markdown

Declared in
Server
Package
libtmux-swift
Source
Sources/LibTmux/Server.swift
Other languages
PythonTypeScriptRustGoJava.NETC++
sessions() ( ) [Session]
methodasync [source]
methodasync [source]
sessions()

Every session on this server, in tmux's own order.

Use isRunning() when absence is an expected probe; a failed listing throws rather than impersonating a running server with no sessions.

Raises

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.