libtmux Reference MCP Search
On this page

libtmux::Server::sessions

View as Markdown

Module
libtmux
Declared in
Server
Package
libtmux-cxx
Source
include/libtmux/server.hpp
Other languages
PythonTypeScriptRustGoJava.NETSwift
sessions ( ) expected< std::vector< Session >, CommandFailure >
methodreadonly [source]
methodreadonly [source]
sessions

One snapshot each.

Iterating or filtering the result never reaches tmux again; taking a current view means calling these again.

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.