Server.panes()
Every pane on this server, in tmux's own order. A pane whose window has several session links appears once.
Source and package
- Qualified name
-
Server.panes() - Declared in
Server- Package
- libtmux-swift
- Source
- Sources/LibTmux/Server.swift
- Other languages
- Perlmethod Erlangfunction PowerShellcmdlet Juliafunction Elixirfunction Haskell Common Lispfunction PythonRubyLuaTypeScriptRustGoJavaC#C++KotlinScalaOCamlF#function Clojurefunction
-
Examples#
Find a window's panes. Read all panes and select those whose windowID matches a newly created window. Pane values are snapshots; reading a property does not query tmux again. Use Swift 6.2 or newer and tmux 3.3a or newer on Linux or macOS. In an empty directory, save this consumer package as
Package.swift; SwiftPM fetches the library from release 0.1.1:// swift-tools-version: 6.2import PackageDescriptionlet package = Package(name: "ApiExample",platforms: [.macOS(.v13)],dependencies: [.package(url: "https://github.com/libtmux/libtmux-swift.git", from: "0.1.1")],targets: [.executableTarget(name: "ApiExample",dependencies: [.product(name: "LibTmux", package: "libtmux-swift"),.product(name: "TmuxFixture", package: "libtmux-swift"),],path: "Sources")])Create a
Sourcesdirectory and save this complete program asSources/Example.swift. ThewithTmuxServerfixture owns a private tmux server and stops it after success or failure. Ordinary application code usesServerfor its own socket; these examples use the fixture until their setup moves to ordinary server objects. View sourceimport Foundationimport LibTmuximport TmuxFixture@mainstruct ApiPanes {static func main() async {do {try await withTmuxServer { @Sendable server inlet session = try await server.newSession(named: "work")let appearance = try await server.newWindow(in: session, named: "logs")let panes = try await server.panes()let logPanes = panes.filter { $0.windowID == appearance.window.id }print("Log panes: \(logPanes.count)")for pane in logPanes {print("Active: \(pane.isActive)")}}} catch {FileHandle.standardError.write(Data("Example failed: \(error)\n".utf8))exit(EXIT_FAILURE)}}}Build and run the saved program. An operation or cleanup error produces a failing exit status. Set
LIBTMUX_TMUX_BINto an absolute executable path to select a tmux version:Terminal window $ swift run ApiExampleExpected output:
Log panes: 1Active: true- Raises
tmux command#
The tmux commands behind panes().
list-panes -a server scope, cmd_list_panes_server tmux C API#
The C declarations in tmux that implement these commands.
In other ports#
List the server's panes
| Language | Equivalent |
|---|---|
| Python | libtmux |
| Ruby | Lib |
| Lua | libtmux |
| PowerShell | Lib Use the -Server parameter set to acquire panes across the server. |
| Julia | Lib panes with a Snapshot reads every captured physical pane. Use paneoccurrences for session placements. |
| Erlang | tmux Returns unique captured physical panes without tmux I/O. |
| Elixir | Lib Returns a Selection of every captured physical pane without contacting tmux. |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| Common Lisp | libtmux: panes on a snapshot returns captured physical panes once each. |
| TypeScript | server |
| Rust | server |
| Go | tmux |
| Java | io |
| Clojure | libtmux Acquires a new graph and returns its pane occurrences. |
| Kotlin | io |
| Scala | io |
| C# | Lib |
| F# | Lib Builds a deferred pane query on the shared .NET LibTmux.Server. Query.list acquires panes across that server. |
| C++ | libtmux:: |
| OCaml | Libtmux |
| Perl | Lib One entry per captured physical pane; raw listings preserve contextual rows separately. |