Repository navigation
Description
Summary
The docs site's Core API showcase (libtmux/docs#243) shows, per capability, a complete example program next to a list of capabilities. It shows a capability for a port only when that port has a program that qualifies, so today this port shows few or none:
- Navigate tmux via a typed object graph
- Watch for changes
- Send keys
- Run applications (where the port has a run-to-exit API)
- Rename windows
- Create windows
- Move windows
- Set layouts
Motivation
A reader copies the example, so it has to build and run as shown, and its CI run has to prove it. Excerpts of larger files and test helpers do not qualify.
Current state: Not yet audited against the rule below. The read-only audit of 2026-11-01 lists this port's APIs and examples per capability; each candidate needs checking against the rule.
Proposal
For each capability the library supports, add one small program under the repository's examples that:
- is a whole file with its imports or
uselines, its entry point and its own server setup on a private socket, and no helper defined elsewhere in the repository; - does one capability and prints or asserts its outcome, for example the captured line after sending keys, or the new window's name after a rename;
- runs in CI on a supported tmux, failing on a non-zero exit or a missing expected line, and states its tmux floor where the capability needs one;
- stays under about 150 lines.
The docs site reads each program whole at the pinned revision; a program it cannot verify is left out rather than excerpted.
References
- libtmux/docs#243: the showcase and its acceptance rule.
Installed control-mode example
A candidate vote-counter program starts a private server, opens a pane watch, sends three votes to an awk process and awaits the child's tally after each vote. Running it from outside the checkout with the locally built rock on Lua 5.5.1 produced this output on native tmux 3.7 and 3.8.
no -> yes=0 no=1
yes -> yes=1 no=1
no -> yes=1 no=2
The installed example suite with this candidate passed all 17 programs on each release. It exercises both sending input and reading a fresh application response. The candidate still needs a published program path and inclusion in the hosted example gate for those two showcase entries. The existing pane-watch example supplies the public operations. Pane watch example
Numbered package and Core examples
The private 0.1.2-1 package check ran 23 complete examples on tmux 3.8 and 20 on tmux 3.3a. The three skipped on 3.3a need control mode from tmux 3.7. The local Core and landing pages also rendered and ran all eight Lua capabilities. Publishing all eight depends on an available public Lua revision and its passing trunk checks. Website PR · Showcase acceptance
Activity
tony commentedon Dec 5, 2026
Draft PR 151 gives the watch and send-keys showcase a runnable calculator. The standalone program drives a real tmux pane, prints
19 + 23 = 42, and checks the same answer from Neovim. Its package test substitutes a wrong answer and a silent program so an echo alone cannot pass. Standalone exampletony commentedon Dec 5, 2026
The vote counter runs the work in a real tmux pane, sends votes and reads the count through control mode. Running it with
no yes noproduced one yes vote and two no votes. The separate window examples cover navigation, moves and layout changes. The website can pin those sources when the native programs have landed. Window examples.Pull request #181.
On the published vote branch, run
lua examples/api/vote_counter.lua no yes nowith tmux 3.7 or newer on PATH. It printedyes=1 no=2on tmux 3.7 with Lua 5.1.5 and on tmux 3.8 with Lua 5.5.1. The three published window examples also ran with PATH alone on tmux 3.3a and 3.8. An absoluteTMUX_BINstill selects a particular executable. Vote counter · Window examples.