Core Library0.xAPI reference

Choose documentation 2

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.

MoreLess about this notice

cmdlet libtmux-powershell

LibTmux.New-TmuxServer

Construct a tmux endpoint handle without contacting it.

Source and package
Qualified name
LibTmux\New-TmuxServer
Declared in
LibTmux
Package
LibTmux
Source
src/LibTmux.PowerShell/NewTmuxServerCommand.cs

Description

Choose a socket name or absolute socket path. Construction performs no tmux I/O and does not start or own a daemon. A later command explicitly acquires data or changes tmux.

Omitting both socket parameters passes tmux no socket, so tmux picks the server: the one the TMUX variable names inside a tmux pane, otherwise its default socket. Two variables choose a socket for such a handle. LIBTMUX_SOCKET_PATH becomes -S and LIBTMUX_SOCKET becomes -L; when both are set the path wins, and a blank value counts as unset. A parameter beats both variables. The handle reads the variables when it is made. LIBTMUX_SOCKET_NAME, which earlier versions read, selects nothing.

What is on here. Most cmdlets in the module start from the handle this one returns. They take it directly, or take a session, window, pane or client that was read through it. The cmdlets fall into a few groups:

Connecting
New-TmuxServer builds the handle. Connect-TmuxServer discovers the live server behind it and returns a connected replacement, and Get-TmuxServer reads the daemon's identity and version without starting one. Connect-TmuxControl opens a control client and Disconnect-TmuxControl closes it.
Finding one thing
Get-TmuxSession and Get-TmuxWindow select by id or name, Get-TmuxPane by id, and Get-TmuxClient by name. A selector that matches nothing emits nothing. Get-TmuxClientAttachment resolves the session, window and pane a client is viewing.
Listing everything
Get-TmuxSession, Get-TmuxWindow, Get-TmuxPane and Get-TmuxClient list everything on the server when given no selector. A missing daemon writes an error instead of returning an empty list. Get-TmuxSnapshot captures the hierarchy to a depth you choose and returns a replacement server. Update-TmuxPane and Update-TmuxClient read one object again into a new capture.
Querying things and getting around
New-TmuxQuery builds reusable criteria. Select-TmuxSession, Select-TmuxWindow and Select-TmuxPane filter objects you already captured without contacting tmux, and can require exactly one match. Invoke-TmuxQuery acquires fresh objects instead. Get-TmuxQueryField lists the fields and operators, Get-TmuxQueryPlan shows how a query will run, and ConvertTo-TmuxQueryJson serializes one. To move down the hierarchy, pass a session to Get-TmuxWindow or Get-TmuxPane, or a window to Get-TmuxPane.
Everything else tmux keeps
Send-TmuxText and Send-TmuxKey type into a pane, Get-TmuxPaneContent reads what it shows, and Wait-TmuxPaneText waits for text to appear. Invoke-TmuxPaneCommand runs a shell command in a pane and reports its exit status. Wait-TmuxChannel waits for a channel signal, and Watch-TmuxEvent streams events from a control client.
Things that need a terminal
Enter-TmuxSession attaches your foreground terminal to a session and returns when you detach. Run it outside tmux; it rejects redirected input.
Running a command
Anything tmux can do that is not here is reachable through Invoke-TmuxCommand, which runs literal tmux arguments and returns the result. Invoke-TmuxChain runs several commands in order, New-TmuxCommand builds one without running it, and Invoke-TmuxControlCommand sends one over a control client.

Notes

The returned LibTmux.Server is unmaterialized. TmuxBinaryPath and ConfigurationFile affect subsequent operations; construction does not execute them.

Command details

Command type
cmdlet
Default parameter set
Name
Positional binding
Enabled.
Outputs
LibTmux.Server
Parameters
Common parameters 12

PowerShell supplies these parameters. See common parameter behavior for their effects.

Returns

LibTmux.Server: Native pipeline type for this command.

Examples

Example 1 Construct a handle for the existing socket identified by $SocketPath. View source

Terminal window
LibTmux\New-TmuxServer -SocketPath $SocketPath

Recorded calls

source calls
No call edges in the PowerShell model.

The PowerShell reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls LibTmux\New-TmuxServer.

Guides

task material

Pages that discuss New-TmuxServer.

In other ports

task equivalence 22 other ports mapped

Source-verified mappings for A tmux server. A mapping says these APIs perform the same task. It does not say they share defaults, errors or completion: check each page.

A tmux server in each port
PortAPIDiffers from PowerShell
PowerShell LibTmux\New-TmuxServer
Construct a tmux endpoint handle without contacting it.
This page
Python libtmux.Server
tmux(1) Server [server_manual].
None recorded in the model
Ruby LibTmux::Server
Connects to an existing endpoint. Closing retires clients, never the daemon.
None recorded in the model
Lua libtmux.Server None recorded in the model
Julia LibTmux.Server
Describe a tmux endpoint without contacting it. Supply exactly one socket selector. A description does not own a daemon or any sessions. Use from_env to opt into the ambient tmux endpoint.
Server describes an endpoint without contacting tmux. Read its hierarchy with snapshot.
Erlang tmux_server
Open tmux endpoints and execute explicit command values.
open/1 observes an existing daemon and starts an endpoint owner. Domain rows remain immutable values.
Elixir LibTmux.Server
An explicit local tmux server descriptor.
Server describes an existing server by executable and socket. It neither connects nor reserves the server’s identity.
Haskell LibTmux.Server
Start, observe and change a tmux daemon through a scoped handle.
LibTmux.Server owns the Server handle. withOwnedServer starts and retires a private daemon; withServer borrows an existing endpoint and releases its own resources afterwards. killServer retires the admitted daemon generation explicitly. Operations such as capture and renameSession are functions of this module that take the handle.
Common Lisp libtmux:client
A connection scope with one external-operation lease. Closing cancels owned work and leaves the tmux daemon alive. Captured data may outlive the client. Public operations never expose its mutable storage.
client is a connection scope with one external-operation lease. Closing it cancels owned work and leaves the tmux daemon alive; daemon owns a daemon the library started.
TypeScript server.Server
One tmux server, addressed by the socket it listens on.
None recorded in the model
Rust server.Server
A cloneable handle to one captured tmux server endpoint.
None recorded in the model
Go tmux.Server
Server is an immutable handle to one tmux configuration. Its zero value is invalid. Copying a configured Server preserves its configuration and shares its mutex-guarded version cache and checked daemon identity, so a Server and the values derived from it are safe for concurrent method calls (see the package documentation).
None recorded in the model
Java io.github.libtmux.Server
Manages sessions, windows, and panes on a tmux server.
readonly
Clojure libtmux.core/open!
Opens local resources for an explicit :socket-path or :socket-name endpoint.
Opens a closeable Java server client for an explicit endpoint. Acquisitions return persistent maps with explicit Java references for effects.
Kotlin io.github.libtmux.kotlin.Server
Manages sessions, windows, and panes on a tmux server.
None recorded in the model
Scala io.github.libtmux.scaladsl.Server
The Java client, opaque: every member beyond java.lang.AutoCloseable#close is an extension, generated from the operation catalog or handwritten where the catalog marks it WAIT, STREAM or LIFECYCLE. Closing an owned client releases its transport, not tmux; close() comes from the AutoCloseable bound with no forwarding of its own, so Using.resource(server) { ... } works.
None recorded in the model
C# LibTmux.Server
Represents an immutable server handle and snapshot.
None recorded in the model
F# LibTmux.FSharp.Server
Starts server reads and queries with the caller's cancellation token.
This F# module provides functions over the shared .NET LibTmux.Server type.
C++ libtmux::Server
One tmux server, addressed by the socket it listens on.
None recorded in the model
Swift Server
A tmux server, addressed by its endpoint.
None recorded in the model
OCaml Libtmux_unix.Client
An explicit generation-bound connection. Applications retain ownership of the endpoint choice and resource lifetime.
A client is a live, generation-bound server connection. Endpoint describes a socket without connecting; closing a client releases its resources.
Perl LibTmux::Server
Explicit tmux acquisition and commands
Construction records connection settings without tmux I/O. Optional LibTmux::Async::Server returns standard Future results for operations.
Raku LibTmux::Server None recorded in the model
Esc
Search in

Type to search.

Reference previewOpen reference