API reference
Browse the TypeScript types and operations for working with tmux. Start with the core objects below, or search for a type or member.
Server 2 types, 2 functions and constants
One tmux server, addressed by the socket it listens on.
A server with a persistent observation connection and daemon-lifetime tracking.
Which run of the daemon a handle came from, counted from zero.
Which tmux daemon answered, as tmux itself reports it.
Session 2 types, 5 functions and constants
One session on one tmux server, as a handle rather than a copy of it.
Criteria matching a session, evaluated against one snapshot.
A session ID in tmux's $n form.
Raw session-ID text or an authenticated session ID.
One session, named unambiguously across servers and daemon restarts.
The readable name this library gives each session format field.
The tmux format fields a session handle is built from, by tmux's own names.
Window 4 types, 6 functions and constants
One window on one tmux server, as a handle rather than a copy of it.
Where a new window lands relative to the one it was created from.
Criteria matching a window, evaluated against one snapshot.
What applying one window needs to know beyond the window itself.
A window ID in tmux's @n form.
Raw window-ID text or an authenticated window ID.
One window, named unambiguously across servers and daemon restarts.
The readable name this library gives each window format field.
A relative direction, or any window target tmux accepts.
The tmux format fields a window handle is built from, by tmux's own names.
Pane 3 types, 5 functions and constants
One pane on one tmux server, as a handle rather than a copy of it.
Which side of the current pane a split puts the new one on.
Criteria matching a pane, evaluated against one snapshot.
A pane ID in tmux's %n form.
Raw pane-ID text or an authenticated pane ID.
One pane, named unambiguously across servers and daemon restarts.
The readable name this library gives each pane format field.
The tmux format fields a pane handle is built from, by tmux's own names.
Client 2 types, 2 functions and constants
One client attached to a tmux server, as a handle rather than a copy of it.
Criteria matching a client, evaluated against one snapshot.
The tmux format fields a client handle is built from, by tmux's own names.
The readable name this library gives each client format field.
Hooks 1 function or constant
The server, session, window, or pane table that holds a hook.
Options 1 type, 1 function or constant
Which table an option is read from or written to.
"Whatever scope tmux would use", as a value rather than an absent argument.
Layout and geometry 1 type, 5 functions and constants
Which edge a resize moves, in tmux's own terms.
A nonnegative cell count within tmux's signed 32-bit geometry range.
A canonical whole percentage from 0% through 100%.
An authenticated cell count or canonical percentage for a pane split.
Test whether a value is valid tmux split geometry.
Authenticate tmux split geometry or throw.
Environment 2 functions and constants
Environments live at server (global) or session scope, as hooks do.
A variable's state in a tmux environment.
Versions 1 type
The tmux version a server is running.
Commands 1 type, 4 functions and constants
One command's result together with how far it got.
Which connection a handle came through.
Making a command refuse to run on a daemon that is not the one it was read from.
One nonempty tmux command, before command-list separators are inserted.
What runs a tmux command for a server.
Formats 1 type, 7 functions and constants
A format tmux expands and reports whenever its value changes.
Which kind of object a format field describes.
Every format field this tmux vocabulary knows, by tmux's own token.
The shapes tmux writes that are not simply text.
The three shapes that name a tmux object rather than describe one.
Which fields carry which shape.
The raw text tmux writes, authenticated where it carries an identity.
What a caller reads for one field, once the text has been decoded.
Queries 1 type, 14 functions and constants
A pattern and its flags, kept apart from any regular-expression object.
Which of the four criteria shapes a handle type is matched with.
A text comparison, of which exactly one form must be given.
A leading digit, which tmux never writes as 0 in a multi-digit number.
The decimal text tmux sends for a field it reports as a number or timestamp.
The text tmux sends for a flag: it writes these two and nothing else.
One field's criteria: a value to equal, or a filter describing how to compare.
How criteria apply to a collection: to any of it, all of it, or none.
How criteria apply to a single related object, which may be absent.
The criteria a selection of this handle type accepts.
Criteria as a portable document: which model, which version, and the criteria themselves.
Compile a regex under the deterministic selection-query work budget.
Validate a WHERE document and restore camelCase criteria names.
Serialize a WHERE document as canonical JSON.
Convert the Python port's name__contains spelling to canonical criteria.
Queries — Fields 2 functions and constants
Idiomatic property names layered over a row, carrying decoded values.
A field's criteria accept its decoded shape as well as the text tmux sends: where({ active: true }) and where({ active: "1" }) are the same query, and serialize identically. A null criterion matches any wire value that the field decoder treats as absent or invalid, rather than one particular wire spelling.
Snapshots 1 type
An immutable view of the server at one instant.
Workspaces — Plans 4 types, 3 functions and constants
What Pane.plan() offers, one entry per mutation it can describe.
What Session.plan() offers, one entry per mutation it can describe.
A tmux command that has been described but not run.
What Window.plan() offers, one entry per mutation it can describe.
Validate and snapshot apply options before server access.
Validate and snapshot planning options before server access.
Workspaces — Session 1 function or constant
The session this workspace names, on a server that may not be running yet.
Workspaces — Functions 1 function or constant
Requests 2 functions and constants
What an engine is asked to run: one ordered command list, and the daemon it must still be talking to.
A daemon-guarded request paired with its exact refusal detector.
Errors 16 types, 5 functions and constants
What any of these errors accepts: the cause, and the tmux command that ran.
The criteria that found nothing, and an optional message replacing the built one.
The criteria that matched too much, with how many it matched when known.
What a failed tmux invocation reported, before it is turned into a message.
The base of every error this library raises.
A command did not complete, and this is how far it got.
What the transport observed when a command did not come back.
A lookup that required one object found none.
A lookup that required one object found several.
A tmux object named by id was not in the list tmux returned.
A field the server is too old to have.
A wait reached its deadline with the condition still unmet.
A selection that required exactly one match found none.
A selection that required exactly one match found several.
Criteria that could not be evaluated, rejected before any command ran.
A tmux command that exited non-zero.
The criteria a lookup was given, carried on the error it raised.
Every value LibTmuxError.code can hold.
What went wrong between this process and tmux, as opposed to inside tmux.
Which half of a lookup was malformed: the id, or the criteria around it.
Errors — Server 1 type
A handle outlived the daemon that issued its id.
Constants and enums 30 types, 5 functions and constants
What every command accepts, whichever handle it is called on.
A finished tmux invocation, as the process left it.
Options for Server.snapshot().
Which side the new pane takes, how big it is, and what runs in it.
How the keys are interpreted before tmux delivers them.
Options for Server.cmd() and the handle-level cmd.
Options for joining a pane into another window.
Options for writing a tmux option.
Which part of a pane is read, and in what form.
Which hook table the binding is written to, and whether it replaces or adds.
How far a pane boundary moves, and in which direction.
Where the shell command runs, and whether the call waits for it.
How the condition is decided: by running it, or by expanding it.
Whether a pane whose process is still alive may be restarted.
Size, placement and lifetime of a popup, which floats over the window rather than taking space from it.
What the interactive chooser shows and what selecting a row runs.
Options for writing a tmux environment variable.
A pane produced output.
A subscribed format expanded to a new value.
A window's layout changed.
A paste buffer was written or deleted.
tmux reported a message, or an error in its configuration.
The control-mode connection is ending.
A notification this version of the package does not model.
The connection dropped and was reopened.
The connection dropped and a replacement is being opened.
Options shared by connected servers and event observers.
Timing for a whole-server state wait.
Options for Server.watch(), a notification-only observer.
Which of tmux's three id spaces an id belongs to.
What an engine reports back: the process's own exit, not tmux's opinion of it.
The criteria shape belonging to one model kind.
Anything a control-mode connection can deliver, as one discriminated union.
Options for Server.connect().
Constants and enums — Server 1 type
How to reach a tmux server, and what to assume when it is quiet.
Constants and enums — Session 5 types
What a new session starts as, and what it is grouped with.
The attached session changed, or a session was renamed.
The set of sessions changed. Carries no payload; re-read the server.
A session's active window changed.
Another client switched sessions.
Constants and enums — Window 6 types
Where a new window lands, and what runs in it.
Where a window is moved to, and what happens if something is already there.
How far a window's own size moves, or what it is set to outright.
A window was added, closed, or linked into or out of a session.
A window was renamed.
The active pane of a window changed.
Constants and enums — Pane 2 types
A pane entered or left a mode such as copy mode.
tmux paused or resumed output for a pane that fell behind.
Constants and enums — Client 1 type
Another client detached.
Testing utilities 5 types, 3 functions and constants
What every recorded entry carries, answered or not.
One invocation and what tmux answered, as JSON.
One invocation that raised instead of answering.
One invocation that failed, and how.
Every invocation one run made, in order.
One entry: either an answer or a failure, never both.
Wrap an engine so every invocation it runs is written down.
An engine that answers from a recording and never starts a process.
Other 6 types, 15 functions and constants
What one tmux invocation cost and how it ended.
The three parts that together name one tmux object for certain.
An immutable, ordered set of tmux objects read at one instant.
One selectable line of a menu: its label, its shortcut, and what it runs.
The part of AbortSignal this package uses.
A live stream of tmux control-mode events.
A tmux object ID authenticated for one object kind.
Raw text or an already-authenticated ID of the expected kind.
A finite whole number within JavaScript's safe integer range.
How far a command got before something interrupted it.
What became of one step of a multi-step operation.
Called once per tmux invocation, after it answers or fails.
Any of the three, discriminated by kind.
A raw format row whose listed identity fields are present.
One decimal character, for building a percentage's shape in the type system.
A leading digit, so "07%" is not a percentage.
Every whole number a percentage may start with, short of one hundred.
A menu entry, or a horizontal rule.
Test whether a value is an exact JavaScript integer.
Test whether a value is a name every supported tmux stores unchanged.
Authenticate an exact JavaScript integer or throw.
By module 21 modules
-
common 26
- Command
Options - Command
Outcome - Command
Result - Logical
Ref Base - Tmux
Invocation Report - is
Safe Integer - safe
Integer - Connection
Alias - Daemon
Epoch - Delivery
Status - Logical
Ref - Operation
Status - Pane
Id - Pane
Id Input - Pane
Ref - Safe
Integer - Session
Id - Session
Id Input - Session
Ref - Tmux
Id - Tmux
Id Input - Tmux
Id Kind - Tmux
Invocation Observer - Window
Id - Window
Id Input - Window
Ref
- Command
-
errors 22
- Lib
Tmux Error - Multiple
Matches Error - Multiple
Objects Error - No
Match Error - Object
Not Found Error - Query
Validation Error - Tmux
Command Error - Tmux
Object Not Found Error - Tmux
Server Restarted Error - Tmux
Transport Error - Version
Too Low Error - Wait
Timeout Error - Exception
Options - Multiple
Objects Error Options - Object
Not Found Options - Tmux
Command Failure Options - Tmux
Transport Error Options - Lib
Tmux Error Code - Query
- Query
Validation Error Code - Query
Validation Reason - Tmux
Transport Error Kind
- Lib
-
ownership 4
-
selection 22
- Client
Where - Pane
Where - Regex
Criteria Data - Selection
- Session
Where - Window
Where - compile
Bounded Regex - decode
Where Document - encode
Where Document - parse
Legacy Where - Many
Relation - Model
Kind Of - Non
Zero Digit - One
Relation - Raw
Flag - Raw
Number - Scalar
Criteria - String
Filter - String
Filter Fields - Where
Document V1 - Where
For Kind - Where
Of
- Client
-
server 3
-
session 3
-
types 66
- Abort
Like - Capture
Options - Choose
Tree Options - Cmd
Options - Connected
Server - Connection
Options - Format
Subscription - If
Shell Options - Join
Options - Menu
Entry - Move
Window Options - New
Session Options - New
Window Options - Planned
Operation - Popup
Options - Resize
Options - Resize
Window Options - Respawn
Options - Run
Shell Options - Save
Buffer Options - Send
Keys Options - Server
Snapshot - Set
Environment Options - Set
Hook Options - Set
Option Options - Snapshot
Options - Split
Options - Tmux
Client Detached Event - Tmux
Client Session Changed Event - Tmux
Event Stream - Tmux
Exit Event - Tmux
Layout Change Event - Tmux
Message Event - Tmux
Output Event - Tmux
Pane Flow Event - Tmux
Pane Mode Changed Event - Tmux
Paste Buffer Event - Tmux
Reconnected Event - Tmux
Reconnecting Event - Tmux
Session Event - Tmux
Sessions Changed Event - Tmux
Session Window Changed Event - Tmux
Subscription Event - Tmux
Unknown Event - Tmux
Version - Tmux
Window Lifecycle Event - Tmux
Window Pane Changed Event - Tmux
Window Renamed Event - Wait
For Options - Watch
Options - is
Split Size - is
Tmux Name - split
Size - Connect
Options - Digit
- Environment
Scope - Environment
Value - Hook
Scope - Menu
Item - Non
Zero Digit - Split
Cell Size - Split
Percentage - Split
Size - Tmux
Event - Window
Target - Zero
To Ninety Nine
- Abort
-
window 3
-
mcp.startup 3