On this page
libtmux::Server::sessions
- Module
- libtmux
- Declared in
- Server
- Package
- libtmux-cxx
- Source
- include/libtmux/server.hpp
- Other languages
- PythonTypeScriptRustGoJava.NETSwift
- sessions ( ) expected< std::vector< Session >, CommandFailure >
-
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
- Python
libtmux.Server.sessions - TypeScript
server.Server.sessions - Rust
server.discovery.Server.sessions - Go
tmux.Server.Sessions - Java
io.github.libtmux.Server.Server.sessions - .NET
LibTmux.Server.Sessions - Swift
Server.sessions()
- Python
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