Server
Describe a tmux endpoint without contacting it. Name at most one socket. A description does not own a daemon or any sessions.
Source and package
- Qualified name
-
LibTmux. Server - Module
- LibTmux
- Package
- LibTmux
- Source
- src/server.jl
- Lib
Tmux .Server(; socket_path , socket_name , tmux, env) -
Description
Server(; socket_path=nothing, socket_name=nothing, tmux="tmux", env=ENV)socket_pathselects a socket file with tmux's-Sandsocket_namea named socket with-L; naming both raisesArgumentError. With neither,envis read:LIBTMUX_SOCKET_PATHselects a socket file andLIBTMUX_SOCKETa named socket, the path first when both are set. A variable that is empty or only whitespace counts as unset, each one alone. A socket named in the call leaves both variables unread. When neither variable is set the server names no socket and passes tmux neither-Snor-L, so tmux picks the server itself: the oneTMUXnames inside tmux, otherwise itsdefaultsocket. Usefrom_envto ask for theTMUXsocket as an explicit path.LIBTMUX_SOCKETnames a socket, so a value that holds a slash raisesArgumentError; put a path inLIBTMUX_SOCKET_PATH. A relative path, from the variable or fromsocket_path, is made absolute against the working directory when theServeris built.envis only the mapping those two variables are read from. It is not the environment a tmux command gets, which is theenvofrun_command, soServer(env=Dict("TMUX_TMPDIR" => dir))changes nothing. The choice is made when theServeris built and kept in the value. AServerheld in aconstkeeps the variables of the process that built it, which under precompilation is the precompiling process.A server that names no socket also leaves
TMUXandTMUX_PANEin the environment of its commands. A command with no target then acts on the paneTMUX_PANEnames, so a barekill-panethroughrun_commandkills the caller's own pane. A named socket drops both variables.tmuxis the executable; a bare name is resolved throughPATHwhen an operation runs. Construction validates the arguments and does not check that the executable or the socket exists. AServeris an immutable value with nothing to close, and the daemon it names may not be running yet:new_sessioncan start one at this endpoint.What is on here
A tmux server does a great many things, so this package has a great many functions that take one. In Julia they sit beside the type rather than on it: each takes a
Serveras its first argument, and most also have a method for aControlConnection. Functions that run tmux accepttimeoutandcancelkeywords, wherecanceltakes aCancellationToken. They fall into a few groups:- Connecting
Serveritself only describes an endpoint. Ask for the endpoint named byTMUXwhen this process is inside tmux, or for thedefaultsocket when it is not. Start a private daemon you own and get back anOwnedServer, or run a function against one and close it afterwards. Attach aControlConnectionto one session; the output, notification, and format-subscription functions need that connection.- The endpoint named in the environmentStart a private daemonRun a function, then close itAttach to one sessionNeed a control connection
- Finding one thing
- Operations act on references, each tied to the daemon it came from. Creating a session, window, or pane returns the reference to what it creates, and a captured session, window, pane, or client carries its own as
.ref. AServerhas no lookup by name: take a snapshot and give the matching function a criterion, such asSessionWhere, and one of the snapshot's collections. The matching function raisesNoMatchErrororMultipleMatchesErrorinstead of choosing for you. - ReferencesReturn a referenceCaptureMatch exactly one
- Listing everything
- Take a snapshot to capture every session, window, pane, and attached client into a
Snapshot; the call raises when tmux does not answer, so an outage never reads as an empty server. Listing what a snapshot holds does not contact tmux again. A snapshot is a point-in-time copy that never refreshes; take another to see later changes. - CaptureList what it holds
- Querying things and getting around
- Criteria are
Criterionvalues that match captured records with no I/O. Pass one tofilter, and theSelectionit returns keeps its snapshot. To move between levels, go down from a session or a window and up from a pane, a window link, or a client. A record can be asked for the snapshot it came from. - Windows of a session, downPanes of a window, downWindow of a pane or window link, upSession of a client or window link, upSnapshot a record came from
- Changing things
- Creating a session, window, or pane returns its reference, and killing one removes it. The rest rearrange what is there: renaming, resizing, respawning, selecting, swapping, moving, linking, and unlinking. Each function acts on tmux when called and returns a
CommandResultunless it creates something. - End a borrowed server, only when told toRenameResizeRespawnSwapMoveLink and unlink
- Options and hooks
- Getting, setting, and unsetting options work at a scope such as
:server,:global_session, or a session, window, or pane reference. The hook functions work the same way, but hooks have no:serverscope. The environment can be read, set, unset, and removed: unsetting deletes an entry, and removing marks a variable for removal from new processes. - OptionsRead and set the environmentDelete an entryRemove from new processes
- Everything else tmux keeps
- For paste buffers, the load function returns a reference that the delete function releases, and the save function reads one back. Paste text or bytes into a pane; each goes through a temporary buffer. Send keys to a pane, and read its screen back as text or as bytes. For formats, one function reads typed fields, one expands a raw expression, and one lists candidate names.
- Load a bufferRelease itRead one backPasteSend keys to a paneScreen as textScreen as bytesRead typed fieldsExpand a raw expressionList candidate names
- Things that need a terminal
- Popups, menus, and prompts, which draw on an attached client's terminal, have no function here. Switching and detaching act on a client that is already attached.
- Switch a clientDetach a client
- Running a command
- Anything tmux can do that is not here is reachable by running a tmux command with literal arguments, or by running several
TmuxCommandvalues as one semicolon group or as independent commands. - One command with literal argumentsSeveral as one semicolon groupSeveral as independent commands
Methods
[source]
- Parameters
-
-
socket_path=nothing -
socket_name=nothing -
tmux="tmux" -
env=ENV
-
Guides
task materialPages that discuss Server.
In other ports
task equivalence 22 other ports mappedSource-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.
| Port | API | Differs from Julia |
|---|---|---|
| Julia | Lib Describe a tmux endpoint without contacting it. Name at most one socket. A description does not own a daemon or any sessions. | This page |
| Python | libtmux tmux(1) Server [server_manual]. | None recorded in the model |
| Ruby | Lib Connects to an existing endpoint. Closing retires clients, never the daemon. | None recorded in the model |
| Lua | libtmux | None recorded in the model |
| PowerShell | Lib Construct a tmux endpoint handle without contacting it. | 2 overloads This cmdlet constructs a shared .NET LibTmux.Server handle without contacting tmux. |
| Erlang | tmux 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 | Lib 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 | Lib 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: 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. | |
| TypeScript | server One tmux server, addressed by the socket it listens on. | None recorded in the model |
| Rust | server A cloneable handle to one captured tmux server endpoint. | None recorded in the model |
| Go | tmux 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 Manages sessions, windows, and panes on a tmux server. | readonly |
| Clojure | libtmux 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 Manages sessions, windows, and panes on a tmux server. | None recorded in the model |
| Scala | io 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. | 2 overloads |
| C# | Lib Represents an immutable server handle and snapshot. | None recorded in the model |
| F# | Lib 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:: 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 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 | Lib Explicit tmux acquisition and commands | Construction records connection settings without tmux I/O. Optional LibTmux::Async::Server returns standard Future results for operations. |
| Raku | Lib | None recorded in the model |