Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-ts latest

Server.panes

Every pane on the server.

Source and package
Qualified name
Server.panes
Module
server
Declared in
Server
Package
libtmux
Source
packages/libtmux/src/server.ts
Other languages
PowerShellcmdlet Juliafunction Elixirfunction PythonRubyLuaRustGoJavaC#C++SwiftKotlinScalaF#function
async panes(): Promise<Selection<Pane>>

Description#

Save this complete program as panes.ts. With Bun 1.4.2 or newer, tmux 3.2a or newer, and libtmux installed, run bun run panes.ts. It creates and stops a private tmux server. A failed operation or cleanup exits with an error; a cleanup error names the retained socket directory.

Examples#

import { strict as assert } from "node:assert";
import { mkdtemp, readdir, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { Server, PaneDirection } from "libtmux";
const directory = await mkdtemp(join(tmpdir(), "ltx-example-"));
const server = new Server({
socketPath: join(directory, "tmux.sock"),
configFile: "/dev/null",
timeoutMs: 5_000,
});
const failures: unknown[] = [];
try {
const session = await server.newSession({
name: "work",
windowName: "editor",
shellCommand: "cat",
});
const pane = session.panes.one();
await pane.split({ direction: PaneDirection.Below, shellCommand: "cat" });
const panes = await server.panes();
assert.equal(panes.count(), 2);
const active = panes.where({ active: true });
assert.equal(active.count(), 1);
console.log("panes:", panes.count(), "active:", active.count());
for (const item of panes) {
assert.equal(item.session?.name, "work");
assert.equal(item.window?.name, "editor");
console.log("location:", item.session?.name, item.window?.name);
}
} catch (error) {
failures.push(error);
} finally {
try {
if ((await readdir(directory)).includes("tmux.sock")) await server.kill();
await rm(directory, { recursive: true });
} catch (error) {
failures.push(new Error(`Cleanup failed; inspect ${directory}`, { cause: error }));
}
}
if (failures.length > 0) throw new AggregateError(failures, "Example failed");

Guides#

Pages that discuss panes.

In other ports#

List the server's panes

Equivalents of List the server's panes in other languages
Language Equivalent
Python libtmux.Server.panes
Ruby LibTmux::Server#list_panes
Lua libtmux.Snapshot.panes
PowerShell LibTmux\Get-TmuxPane Use the -Server parameter set to acquire panes across the server.
Julia LibTmux.panes panes with a Snapshot reads every captured physical pane. Use paneoccurrences for session placements.
Elixir LibTmux.Snapshot.panes/1 Returns a Selection of every captured physical pane without contacting tmux.
Rust server.Server.panes
Go tmux.Server.Panes
Java io.github.libtmux.Server.panes
Kotlin io.github.libtmux.kotlin.Server.panes
Scala io.github.libtmux.scaladsl.Server.panes
C# LibTmux.Server.Panes
F# LibTmux.FSharp.Server.panes Builds a deferred pane query on the shared .NET LibTmux.Server. Query.list acquires panes across that server.
C++ libtmux::Server::panes
Swift Server.panes()
Esc

Type to search.

Reference previewOpen reference