LibTmux — README

libtmux Raku examples

Build an observatory display, watch a downlink, and recover from a failed launch. These complete Raku programs use LibTmux to own private tmux servers. Each closes its clients and daemon when it exits.

Run commands from the repository root after the toolchain setup, with a supported tmux executable on PATH:

$ zef install .
TaskProgramRaku facilities
Create and find panesQuickstartObjects, LEAVE, a native predicate
Choose wide instrumentsPane queriesTyped selections, query hashes, grep, map, sort
Add a telemetry displayFloating panesCapability checks and a tiled fallback
Receive a downlinkWatch outputPromise, Supply, react, whenever
Combine the workflowObservatoryEvents, captured graphs and query plans
Recover from a failed launchBatch recoveryTyped outcomes and explicit recovery

Create and find panes

The quickstart is the complete first program in the root README. It creates two panes, sets their titles, and finds the telescope through a fresh snapshot. The earlier snapshot retains one pane.

$ raku -I. examples/quickstart.raku

It prints Starlight telescope: 2 panes.

Choose wide instruments

The pane query program creates a telescope, weather display and spectrum recorder. .where selects the wide panes, .filter finds the telescope, and .single checks cardinality. Native .grep, .map and .sort produce the remaining instrument names as ordinary Raku values.

$ raku -I. examples/query-panes.raku

It prints Wide telescope: Starlight telescope and Other instruments: Orion weather, Spectrum recorder.

Use := when binding a typed selection to an array variable. Assignment with = materializes ordinary array membership. Repeated traversal reads the captured members; it does not refresh tmux.

Add a telemetry display

The floating-pane program creates an Aurora telemetry pane. It checks the daemon's pane-floating capability, chooses a floating pane when available, and otherwise splits the tiled window.

$ raku -I. examples/floating-panes.raku

It prints the selected placement, then Aurora telemetry. The empty display has no child process on profiles that report an absent PID; the pane still belongs to the captured graph. Consult capabilities before offering an operation to a user.

The output watcher awaits asynchronous snapshot and control connection operations, subscribes to pane-output events, and sends the downlink. react and whenever collect fragmented bytes until the complete message arrives. It then checks the captured screen.

$ raku -I. examples/watch-output.raku

It prints Starlight downlink: 42 stars catalogued and Screen capture confirmed. The deadline bounds the wait. Multiple event subscribers share the same owned connection. Sending text and pressing Enter are separate operations.

Run the complete observatory

The observatory combines pane creation, literal input, control-mode observation and screen capture. It filters a snapshot with query data and a Raku predicate, then compares an exact source query with the captured pane. Its query plan shows where evaluation takes place.

$ raku -I. examples/observatory.raku

The output includes Observatory: 2 instruments, Starlight telescope: Starlight exposure complete: 42 stars catalogued, and Owned clients, daemon and socket cleaned up.

Recover after a command fails

The batch recovery example sets an option, sends an invalid command, and checks that the following command was skipped. It verifies the first effect and removes it explicitly.

$ raku -I. examples/batch-recovery.raku

It reports Complete, Failed and Skipped outcomes, followed by Recovery: removed the first effect explicitly and Owned daemon and socket cleaned up. A failed batch does not undo commands that already succeeded.

Select a tmux executable

Every program except the minimal quickstart accepts --tmux. For that quickstart, select the supported binary through PATH. The repository's example check selects LIBTMUX_TEST_TMUX through a private temporary PATH, checks displayed source against these files, runs all programs, checks their results, and rejects leftover owned socket directories. See Contributing for validation.

LibTmux v0.0.1

Typed tmux observations, queries and explicit commands for Raku

Authors

  • libtmux contributors

License

MIT

Dependencies

JSON::Fast:ver<0.21.0+>:auth<zef:timo>

Test Dependencies

Provides

  • LibTmux
  • LibTmux::Attachment
  • LibTmux::Batch
  • LibTmux::Capabilities
  • LibTmux::Catalogue
  • LibTmux::Client
  • LibTmux::Command
  • LibTmux::Configuration
  • LibTmux::Control
  • LibTmux::Control::Connection
  • LibTmux::Engine
  • LibTmux::Exceptions
  • LibTmux::Fields
  • LibTmux::Format
  • LibTmux::Layout
  • LibTmux::Model
  • LibTmux::Operations
  • LibTmux::Query
  • LibTmux::Query::Execution
  • LibTmux::Query::Plan
  • LibTmux::Selection
  • LibTmux::Server
  • LibTmux::Transport
  • LibTmux::Types

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.