Try a standard-library core and Tokio adapter
This runnable prototype splits pane values and capture requests into a dependency-free core, with live handles in a separate Tokio package. It supports pane listing and capture. It is an experiment, not a replacement for the published client.
| Package | What belongs there |
|---|---|
libtmux¶ | Pane IDs, detached snapshots, capture requests, and captured bytes. No dependencies. |
libtmux-tokio¶ | Concrete server and pane handles, plus asynchronous execution. |
Run it without Tokio¶
Use Rust 1.97.1, the repository’s pinned toolchain; the manifests require
Rust 1.97 or newer. The live example requires Unix and tmux 3.2a or newer on
PATH. The check script also requires Bash.
Clone the repository:
$ git clone https://github.com/libtmux/libtmux-rs.gitCheck out the revision used by the linked programs:
$ git -C libtmux-rs checkout --detach d7541fbace16d6a45882cd0af0ea6880f9c21748Enter its standalone Cargo workspace:
$ cd libtmux-rs/experiments/standard-library-coreBuild a capture request and decode captured bytes without starting tmux:
$ cargo run --locked -p split-demo --bin offlineThe offline program uses only the core. Its dependency graph is small enough to inspect directly:
$ cargo tree --locked -p split-demoCapture a live pane¶
With tmux 3.2a or newer on PATH, enable the adapter:
$ cargo run --locked -p split-demo --features live --bin liveThe live program starts an isolated server, prints a message in a pane,
then captures it through the Tokio adapter. It also reads a detached snapshot
after shutting down the runtime. It kills its own server and removes its
socket under /tmp/libtmux-rs-dev/ when finished.
Set LIBTMUX_TEST_TMUX to choose a different tmux executable. Both programs
print human-readable output to stdout, report errors to stderr, and exit zero
on success and nonzero on failure.
The offline consumer builds a capture request synchronously. The live consumer passes that same core type to the adapter and receives captured bytes. Both links contain complete programs. Server and pane handles have concrete types; a runtime type parameter does not spread through the API.
What the experiment decides¶
A strict core can own useful values and requests while the adapter owns I/O. The core has no optional, build, target, or test dependencies either. The workspace’s check script verifies the dependency graph and runs both programs:
$ bash check.shThe adapter bounds each output pipe to 2 MiB and gives each command five seconds. It handles direct child processes only. A full migration must retain the published client’s supervision, cancellation, process-group cleanup, and control-mode behaviour; this small adapter does not establish that parity.
Quinn and Tokio Tungstenite show how protocol logic and runtime adapters can live in separate packages. Their cores still have external dependencies. Zero dependencies is a stronger requirement: regex matching would need a companion package, and Serde would need wrappers or wire types for core values because of Rust’s orphan rules. Those integrations remain outside this prototype.