Expand description
tmuxctl — a bidirectional tmux control-mode (tmux -C) client.
This crate is the wire between a Rust front-end and a tmux server: it spawns
tmux -C, parses the %-prefixed notification stream into typed
Notifications, correlates command replies by command-number, octal-decodes
pane output to raw bytes, and models tmux’s layout tree (Layout).
It is a protocol layer only — no terminal emulation, no rendering, no UI.
Those are the consumer’s job (see hangar).
The protocol contract lives in docs/spec/overview.md; a map of the tmux C
source that backs each wire detail lives in docs/reference/tmux-source-map.md.
§Status
Early. The value types (PaneId, Notification, Layout), the pure
helpers (decode_output, layout::checksum, Layout::parse), and the
synchronous line Parser (framing + %begin/%end reply blocks) are in
place and tested. The async Client (spawn tmux -C, drive the parser over
tokio pipes, correlate replies to futures) is the next slice.
Re-exports§
Modules§
- layout
- tmux window-layout strings: the typed tree, the checksum, and parse/render.
- parser
- Incremental line parser for the tmux control-mode stream.
Structs§
- Client
- A blocking tmux control-mode client.
- Command
Id - An opaque handle correlating a sent command to its eventual reply. A driver
tags each outstanding command with the id from
Engine::register_commandand matches it againstIncoming::Reply. - Command
Output - A command’s
%endreply: its (possibly empty) output lines. - Engine
- The sans-IO protocol core: parser + outstanding-command FIFO + framing buffer.
- PaneId
- A tmux pane id —
%<n>on the wire. - Session
Id - A tmux session id —
$<n>on the wire. - Spawn
Opts - How to spawn the
tmux -Ccontrol client.Defaultrunstmux -C new-session -A(attach-or-create the default session) on the default server. - Window
Flags - tmux’s window flags, the raw-flags field of
%layout-change(window_printable_flagsin tmuxwindow.c). Each known flag is a named field; any character tmux adds that we don’t model yet is retained inunknown, so the set is forward-compatible and nothing is dropped. - Window
Id - A tmux window id —
@<n>on the wire.
Enums§
- Command
Error - Why a command did not return successful output.
- Error
- Errors from the pure core. Two failure kinds live in their own types rather than
here: a command’s
%errorreply iscrate::CommandError, and session teardown iscrate::Notification::Exit— drivers own their ownstd::ioerrors. So the core’s only fallible operation is layout parsing.#[non_exhaustive]keeps adding a future variant non-breaking. - Incoming
- A correlated outcome the engine surfaces from one input line.
- Notification
- A parsed tmux control-mode notification.
Functions§
- decode_
output - Decode a tmux
%output/%extended-outputpayload back to raw bytes.
Type Aliases§
- Result
- Crate-wide result alias.