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.

struct libtmux-swift latest

Pane

A tmux pane, as it was when the listing was read.

Source and package
Qualified name
Pane
Package
libtmux-swift
Source
Sources/LibTmux/Pane.swift
Other languages
Perlclass ErlangPowerShellcmdlet Juliastruct Elixirstruct Haskell Common Lispclass PythonRubyLuaTypeScriptRustGoJavaC#C++KotlinScalaOCamlF#module Clojurefunction
struct Pane : struct Pane

Description#

A pane belongs to one window; session membership runs through WindowLink.

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.2
import PackageDescription
let 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 Sources directory and save this complete program as Sources/Example.swift. The withTmuxServer fixture owns a private tmux server and stops it after success or failure. Ordinary application code uses Server for its own socket; these examples use the fixture until their setup moves to ordinary server objects. View source

import Foundation
import LibTmux
import TmuxFixture
@main
struct ApiPanes {
static func main() async {
do {
try await withTmuxServer { @Sendable server in
let 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_BIN to an absolute executable path to select a tmux version:

Terminal window
$ swift run ApiExample

Expected output:

Log panes: 1
Active: true

Members22#

Common operations12#

  • id: let id: PaneID property tmux's own pane id — %0, %1.
  • index: let index: Int property Position within its window, renumbered as panes come and go.
  • height: let height: Int property The height tmux is drawing this pane at, in cells.
  • width: let width: Int property The width tmux is drawing this pane at, in cells.
  • isActive: let isActive: Bool property The pane a command reaches when it names the window and stops there.
  • currentCommand: let currentCommand: String property The command tmux believes is running. It reflects the foreground process, so it changes as the user works.
  • currentPath: let currentPath: String property The working directory of the process in the pane, which follows the user around rather than staying where the pane was created.
  • windowID: let windowID: WindowID property The window this pane is in. Panes move between windows, so this is where it is now rather than where it started.
  • isAtTop: let isAtTop: Bool property Whether the pane reaches its window's top edge. A pane can be against more than one edge, and a lone pane is against all four.
  • isAtBottom: let isAtBottom: Bool property Whether the pane reaches its window's bottom edge.
  • isAtLeft: let isAtLeft: Bool property Whether the pane reaches its window's left edge.
  • isAtRight: let isAtRight: Bool property Whether the pane reaches its window's right edge.

Other members10#

Inherited members2 members#

Reached through Equatable.!=(_:_:), Decodable.init(from:).

  • !=(_:_:) function inherited Returns a Boolean value indicating whether two values are not equal.
  • init(from:) method inherited Creates a new instance by decoding from the given decoder.

Guides#

Pages that discuss Pane.

In other ports#

A tmux pane

Equivalents of A tmux pane in other languages
Language Equivalent
Python libtmux.Pane
Ruby LibTmux::Pane
Lua libtmux.Pane
PowerShell LibTmux\Get-TmuxPane This cmdlet reads shared .NET LibTmux.Pane objects. Its -Server, -Session, and -Window parameter sets select the scope.
Julia LibTmux.PaneSnapshot PaneSnapshot holds captured pane data. Actions use its PaneRef; PaneOccurrence adds a window placement in a session.
Erlang #tmux_model:pane{}
Elixir LibTmux.Pane Pane is an immutable physical pane observation. It does not send keys or capture text.
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
Common Lisp libtmux:pane pane is an immutable captured physical pane.
TypeScript pane.Pane
Rust pane.Pane
Go tmux.Pane
Java io.github.libtmux.Pane
Clojure libtmux.data/panes Traverses captured pane maps without I/O. Use keyword lookup for scalar observations and the preserved :tmux/ref for effects.
Kotlin io.github.libtmux.kotlin.Pane
Scala io.github.libtmux.scaladsl.Pane
C# LibTmux.Pane
F# LibTmux.FSharp.Pane This F# module reads captured fields and starts explicit operations on the shared .NET LibTmux.Pane type.
C++ libtmux::Pane
OCaml Libtmux.Pane.t
Perl LibTmux::Pane A physical pane retains its captured graph, without retaining transport.
Esc

Type to search.

Reference previewOpen reference