Core LibraryunreleasedGuides

Choose documentation 2

latest

Current version

latest
English

Unreleased libtmux has not been released. Its API may change during development. This site's structure and URLs may change too.

Install and run your first capture

Use the README installation with OCaml 5.5.2, opam and tmux on Linux. The native clients compile a small Linux C helper and require a C compiler and system headers. This source checkout installs the libraries; no registry release is available yet.

Activate the local switch in the current shell as shown in the README before changing to a separate project. This exports the switch choice for opam exec without changing shell startup files or the global default switch.

For a blocking program, use a Dune executable with libtmux and libtmux-unix:

(executable
(name main)
(libraries libtmux libtmux-unix))

For the Eio examples, link the Eio backend and the application’s runtime entry point instead:

(executable
(name main)
(libraries libtmux libtmux-eio eio_main))

Create dune-project with (lang dune 3.24), save the graph program as main.ml, and build from that project. The installed-example check does this outside the repository with a separate install prefix; it does not depend on source-tree library resolution.

Terminal window
$ opam exec -- dune build

Select an endpoint explicitly

Endpoint.socket_path accepts an absolute socket path; Endpoint.named_socket describes tmux’s -L name. Constructing either performs no I/O. Ordinary Client.connect attaches to an existing daemon and does not start one.

The private demo setup creates an owned socket and a cat pane. Run the graph program with the tmux binary and socket path, or copy its complete source into your project. It captures the graph, closes its connection and prints retained observations.

A connection identifies the daemon PID twice around pidfd acquisition. The client and daemon must share a PID namespace and local scratch filesystem; an accessible socket by itself does not establish those conditions. A stale source is an error, never permission to reconnect a mutation automatically.

Run a concurrent application

The complete Eio example calls Eio_main.run and Eio.Switch.run, then supplies process_mgr and mono_clock from the application environment. Use that outer shape in your application. Capturing and querying values does not require adopting Eio in the pure core.

Expected failures return result and print with Error.pp. Backend cancellation propagates separately. Clients and subscriptions belong to their connecting domain; immutable observations can be shared. Close owned resources with Fun.protect or the supplied Eio switch.

Object graph · Queries · Control · API · Compatibility

Esc

Type to search.

Reference previewOpen reference