On this page
C++ API reference
777 symbols, extracted from source. Every type name in a signature links to its own entry; every cross-reference in a doc comment resolves against the same table.
By module 14 modules
- libtmux 127
- abi.hpp 3
- capabilities.hpp 2
- libtmux::client 8
- libtmux::detail 6
- libtmux::FilterExpr 6
- libtmux::NotificationRange 1
- libtmux::pane 15
- libtmux::session 8
- libtmux::test 11
- libtmux::tmuxq 1
- libtmux::window 13
- std::hash<libtmux 4
- Types 4
Server 4 types
Session 2 types
Window 2 types
Pane 2 types
Client 2 types
Options 1 type
Buffers 1 type
Versions 1 type
Commands 11 types
Result obligations outstanding when the first close succeeded.
ExecutionPolicy 2 membersAbsent means wait. That is a thing to mean deliberately.
Control mode 10 types
Formats 2 types
Queries 1 type
Queries — Fields 6 types
Queries — Operators 5 types
Queries — Expressions 2 types
Snapshots 2 types
Requests 2 types
Errors 7 types
Constants and enums 7 types
Where to start, counting back into the scrollback.
ConnectionOptions 9 members ControlRequestResult 2 membersEvery synchronous reply block tmux emitted for this request, in wire order.
SplitOptions 8 membersSide by side. tmux stacks by default.
Constants and enums — Session 1 type
Constants and enums — Window 1 type
Testing utilities 10 types
Functions and constants 0 types
- active : BoolFieldHandle< Pane >
- active : BoolFieldHandle< Window >
- activity : BoolFieldHandle< Window >
- attached : BoolFieldHandle< Session >
- bell : BoolFieldHandle< Window >
- client_count : NumberFieldHandle< Session >
- command : StringFieldHandle< Pane >
- control_mode : BoolFieldHandle< Client >
- dead : BoolFieldHandle< Pane >
- group : StringFieldHandle< Session >
- grouped : BoolFieldHandle< Session >
- height : NumberFieldHandle< Client >
- height : NumberFieldHandle< Pane >
- height : NumberFieldHandle< Window >
- id : StringFieldHandle< Pane >
- id : StringFieldHandle< Session >
- id : StringFieldHandle< Window >
- in_mode : BoolFieldHandle< Pane >
- index : NumberFieldHandle< Pane >
- index : NumberFieldHandle< Window >
- kCommandSeparator : std::string_view
-
How much of one reply a decoder holds, and how long a single line may grow before the stream is called broken.
A subprocess ends and gives its memory back; a connection does not, so the bound has to be in the decoder rather than in whatever reads it afterwards. The reply bound is the subprocess transport's capture limit, so the same call costs the same memory over either transport. The line bound has no subprocess equivalent: it is the point past which an unterminated line is evidence of a broken stream rather than a large answer.
- kFormatEscape : std::string_view
-
A separator absent from every format name is not absent from every format value, which is the whole difficulty.
tmux rename-window 'a␞b` is accepted, and one such name used to make every window and pane listing on that server fail to split — data the caller never chose breaking reads of everything else.
So tmux escapes the separator before it can be mistaken for one. U+241B pairs with it and is escaped in turn, which is what makes the transform reversible:
␛Sis a separator that was in the value and␛Eis an escape marker that was, and neither has a second reading.
- kFormatSeparator : std::string_view
-
tmux joins requested formats with a separator that cannot appear in a format name.
U+241E matches the Python implementation's default so both can read the same recorded output.
It is multi-byte, so every tmux this library starts is passed
-u: a tmux that believes the terminal is not UTF-8 substitutes an underscore and no row splits at all.
-
The oldest release this library supports, matching the Python package.
-
Named keys tmux accepts, taken from the table in its own key-string.c at the oldest supported release.
Function keys are generated rather than listed, and a single character is handled separately.
- layout : StringFieldHandle< Window >
- name : StringFieldHandle< Client >
- name : StringFieldHandle< Session >
- name : StringFieldHandle< Window >
- pane_count : NumberFieldHandle< Window >
- path : StringFieldHandle< Pane >
- path : StringFieldHandle< Session >
- pid : NumberFieldHandle< Pane >
- read_only : BoolFieldHandle< Client >
- session_id : StringFieldHandle< Pane >
- session_id : StringFieldHandle< Window >
- session_name : StringFieldHandle< Client >
- session_name : StringFieldHandle< Pane >
- session_name : StringFieldHandle< Window >
- terminal : StringFieldHandle< Client >
- title : StringFieldHandle< Pane >
- tty : StringFieldHandle< Client >
- tty : StringFieldHandle< Pane >
- width : NumberFieldHandle< Client >
- width : NumberFieldHandle< Pane >
- width : NumberFieldHandle< Window >
- window_count : NumberFieldHandle< Session >
- window_id : StringFieldHandle< Pane >
- zoomed : BoolFieldHandle< Window >
- all_of ( typename Entity , name : std::string , read : auto , predicate : auto ) typename Entity
- any_of ( typename Entity , name : std::string , read : auto , predicate : auto ) typename Entity
- capture_lines ( typename Text , Text && ) typename Text ( output : std::string_view ) std::vector< std::string_view >
-
The lines are views into the text, so text that dies at the semicolon takes them with it — and
pane.capture()returns its output by value, which makescapture_lines(*pane.capture())the natural thing to write and a use-after-free to run.Deleted for an rvalue string only: an lvalue string converts as before, and so does a literal.
- children_of ( typename Parent , typename Child , rows : const std::vector< Child > & , foreign_key : StringFieldHandle< Child > , key : StringFieldHandle< Parent > ) typename Parent ( typename Parent , typename Child , const std::vector< Child > && , StringFieldHandle< Child > , StringFieldHandle< Parent > ) typename Parent
-
Join two listings on the id one of them carries.
A relation predicate has to reach the related rows without running tmux, so the caller lists both kinds once and links them here. The result borrows the rows it was given, exactly as a filtered view does, so it must not outlive the listing it reads.
- current_environment ( ) std::vector< std::string >
-
Build and edit a
NAME=VALUEblock for a child process.current_environmentcopies this process's;set_environmentreplaces any existing entry rather than appending;erase_environmentremoves every entry for the name.
-
Undo that escaping, in place.
Escaping only ever lengthens, so the decoded bytes fit where the encoded ones were: the write cursor never overtakes the read cursor, nothing moves, and nothing is allocated. Answers the decoded length.
An escape marker followed by anything else is left as written. Output this library asked for contains no such sequence, and failing on one would mean a recording could not carry a literal
␛.
- describe_running_tmux ( tmux_binary : const std::filesystem::path & = "tmux" ) std::string
-
What
tmux -Vprinted, verbatim, or "unknown".
- erase_environment ( environment : std::vector< std::string > & , name : std::string_view ) void
- escape_literal ( text : std::string_view ) std::string
-
Escape literal text for inclusion in a format string.
-
exactly_onestates that several is a caller error, and says which one.Discussed in Filtering and querying, in practice
-
firststates that a caller tolerates extras; it never reports several.
- format_request ( fields : std::span< const std::string_view > ) std::string
-
Build the format argument for one entity's fields, terminating every field so a trailing empty value is still a value rather than a missing column.
The two substitutions nest rather than run in sequence, because tmux applies the inner one to the raw value and the outer one to its result. In that order a value already holding the escape marker is neutralised before the separator pass can produce one; reversed, the two become indistinguishable.
#{s/…/…/:…}predates every tmux this library supports, and neither character is a regular-expression metacharacter.Unconditional, rather than applied only to the fields that could carry a separator. Expanding the substitutions costs about 0.32us per row — a 61-row listing pays 19us, against a process launch of some milliseconds — and a per-field exemption list is a thing to get wrong later, once, silently.
- is ( typename Entity , name : std::string , read : auto , predicate : auto ) typename Entity
-
An absent to-one link never satisfies
is: a window with no active pane is not a window whose active pane runs an editor.
- is_function_key ( name : std::string_view ) bool
- is_key_name ( key : std::string_view ) bool
-
Accept a key with any number of C-, M-, or S- modifiers.
- is_pane_id ( value : std::string_view ) bool
-
Whether a value is written as an id, which is what decides that it needs no separator validation below — not whether tmux would resolve it.
xis an id by this test and no pane by tmux's, and both are right: it carries no separator, so composing it can only produce the caller's own mistake back.
- is_session_id ( value : std::string_view ) bool
- is_window_id ( value : std::string_view ) bool
- library_version ( ) std::string_view
-
This package's own version, not tmux's.
- literal_arguments ( text : std::string_view ) expected< std::vector< std::string >, KeyError >
-
Send text exactly as written: the flag, the end of flags, and the text.
--is part of the fragment rather than something a caller appends, because text beginning with a dash is read as anothersend-keysoption without it and that is not a mistake worth making twice. It was made twice: this returned the flag and the text alone,Pane::send_textinserted the separator afterwards, andChain::send_textdid not — so the same text through the two spellings reached tmux as two different commands.
- lookup_of ( name : std::string_view ) expected< StringOp, LookupParseError >
-
eqis the implicit lookup, matching Python's barefield=value.An empty name reaches here only from a key that carried no separator at all; a key ending in one is refused before this is asked.
- lower ( typename Entity , typename Sink , expr : const FilterExpr< Entity > & , sink : Sink & ) typename Entity
-
A sink receives one call per node in prefix order.
Groups and negations are bracketed by begin/end so a sink never has to count operands itself.
- matching ( typename Entity , expr : FilterExpr< Entity > ) typename Entity
-
matching(expr)is a range adaptor closure so it composes with std views.
- matching ( typename Entity , expr : FilterExpr< Entity > ) typename Entity ( typename Entity , field : BoolFieldHandle< Entity > ) typename Entity
-
matching(expr)is a range adaptor closure so it composes with std views.
- name_of ( op : StringOp ) std::string_view ( op : NumberOp ) std::string_view
- none_of ( typename Entity , name : std::string , read : auto , predicate : auto ) typename Entity
- pane_target ( session : std::string_view , window : std::string_view , pane : std::string_view ) expected< std::string, TargetError >
-
A pane target is its id, or
session:window.pane.
- parent_of ( typename Child , typename Parent , rows : const std::vector< Parent > & , foreign_key : StringFieldHandle< Child > , key : StringFieldHandle< Parent > ) typename Child ( typename Child , typename Parent , const std::vector< Parent > && , StringFieldHandle< Child > , StringFieldHandle< Parent > ) typename Child
-
The same join read the other way: the one row a child points at, or none.
- parse ( notification : const Notification & ) ParsedNotification ( Notification && ) ParsedNotification
- parse_lookup ( typename Entity , term : std::string_view , fields : std::span< const StringFieldHandle< Entity > > ) typename Entity
-
Parse one
field[__lookup]=valueterm against a caller-supplied field table.The value is taken verbatim after the first
=, so a value containing=or__survives unchanged; only the key is split.
- parse_option ( line : std::string_view ) std::optional< OptionEntry >
-
Parse one line.
Returns nullopt for a blank line so callers can feed raw output straight in.
- parse_options ( output : std::string_view ) std::vector< OptionEntry >
- parse_version ( output : std::string_view ) expected< Version, VersionError >
-
Parse the first line of
tmux -V, with or without its trailing newline.
- path_component ( name : std::string_view ) expected< std::string, TargetError >
-
Validate one path component.
Ids skip validation because they contain no separator by construction.
- quantified ( typename Entity , name : std::string , quantifier : Quantifier , read : auto , predicate : auto ) typename Entity
-
To-many and to-one links take different accessors, so they get different builders rather than one that has to compile both shapes.
- replay ( typename Sink , nodes : const LoweredExpression & , sink : Sink & ) typename Sink
-
Replay an already-lowered child into a sink.
-
Resolved once per distinct binary and cached.
A tmux that cannot be run or whose version cannot be parsed reports as the newest possible version, so version-gated tests run and fail rather than silently skipping.
- same_entity_id ( left_id : std::string_view , left_session_id : std::string_view , right_id : std::string_view , right_session_id : std::string_view ) bool
- server_over ( backend : std::shared_ptr< const Backend > ) Server
-
Declared so the private constructor has exactly one way in.
Defined in a header this package does not install.
- session_target ( session : std::string_view ) expected< std::string, TargetError >
-
A session target is its id, or its validated name.
- set_environment ( environment : std::vector< std::string > & , name : std::string_view , value : std::string_view ) void
- socket_name_arguments ( name : std::string_view ) expected< std::vector< std::string >, SocketError >
-
-L name: a single component resolved under the socket directory.
- socket_path_arguments ( path : std::string_view ) expected< std::vector< std::string >, SocketError >
-
-S path: used verbatim, so the address limit applies to it directly.
- split_row ( line : std::string_view , fields : std::size_t , values : std::vector< std::string_view > & ) bool
-
Split one tmux output line into its field values.
The trailing separator emitted by
format_requestproduces one empty tail element, which is dropped; a short or long row is reported rather than padded so a format-name typo cannot masquerade as an empty field.
- to_flag ( text : std::string_view ) bool
-
tmux renders flag formats as "1" or "0"; anything else is not the flag.
- to_number ( text : std::string_view ) long long
-
tmux renders every value as text.
These read the three shapes it uses, and answer zero, false or the epoch for a value it did not render — which within the supported version range means tmux had nothing to say, not that the token was unknown.
- to_string ( implementation : ServerImplementation ) std::string_view ( backend : BackendKind ) std::string_view ( feature : ServerFeature ) std::string_view ( error : CardinalityError ) std::string_view ( kind : FailureKind ) std::string_view ( status : DeliveryStatus ) std::string_view ( error : KeyError ) std::string_view ( kind : NotificationKind ) std::string_view ( error : SocketError ) std::string_view ( error : TargetError ) std::string_view ( error : VersionError ) std::string_view
- to_time ( text : std::string_view ) std::chrono::sys_seconds
-
A factory rather than an alias: an alias template cannot deduce its argument, so
unexpected(error)would stop compiling at every call site.
- unquote ( value : std::string_view ) std::string
-
Undo the quoting tmux applies when it prints a value.
tmux picks one of four forms, and a reader that knows only one corrupts the rest: '
for an empty value; double quotes when the value contains any of#';${}; single quotes when it contains a double quote; and otherwise no quotes at all. Inside any of them the body is escaped the wayvisdoes it —\t,\n,\\,\ooo` for a byte with no printable form — and a leading tilde is escaped whether or not anything else is.This is the inverse of tmux's own
args_escape, so a value read here and written back is the value that was there.
- variable ( name : std::string_view ) std::string
-
Wrap a variable name as a substitution.
The name is not escaped: a name is chosen by the caller from tmux's format vocabulary, not built from data.
- window_target ( session : std::string_view , window : std::string_view ) expected< std::string, TargetError >
-
A window target is its id, which needs no session, or
session:window.
- without_trailing_blanks ( lines : std::vector< std::string_view > ) std::vector< std::string_view >
-
Drop the blank rows a pane pads its height with, keeping blank lines that have content below them.
- CommandObserver : std::function< void(std::string_view command, const CommandFailure *failure)>
-
Told about every command, as it finishes.
There is otherwise no way to see what this library ran: a caller debugging a tmux interaction has only the failures, and nothing at all when things succeed. The command is rendered as tmux received it, with any argument marked sensitive replaced.
Synchronous calls invoke it on their caller's thread. Asynchronous calls invoke it only on the thread calling
CommandRuntime::dispatch_ready. No internal lock is held; a shared observer must synchronise itself. Both callback arguments expire on return.
- Event : std::variant< ControlBlock, Notification >
- LoweredExpression : std::vector< LoweredNode >
-
The related entity is whatever the accessor yields, so a bare flag field can stand in for a predicate here exactly as it does in
matching.