# tmux client library for Raku

Source: https://libtmux.org/en/raku/latest/core/

> tmux client library for Raku. Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, watch for changes via control mode, capture pane contents

LibTmux gives Raku programs typed snapshots of a tmux server, ordinary
predicates over them, and explicit commands that change tmux. Reading a
snapshot makes no further tmux calls; an operation through a reference does.

The LibTmux distribution from the zef:libtmux authority is published on Raku Land. Its API
is experimental and may change between `0.x` releases. CI qualifies Rakudo
2026.09 on Linux with tmux 3.3a and 3.8; other platforms and compiler versions
are unverified. The library has no workspace manager or MCP server.Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, watch for changes via control mode, capture pane contents.

## At a glance

| Type | Wraps |
| ---- | ----- |
| [`LibTmux::Server`](https://libtmux.org/en/raku/latest/reference/libtmux-server/) | A tmux server |
| [`LibTmux::Model::Session`](https://libtmux.org/en/raku/latest/reference/libtmux-model-session/) | A session, ID `$n` |
| [`LibTmux::Model::Window`](https://libtmux.org/en/raku/latest/reference/libtmux-model-window/) | A physical window linked into sessions, ID `@n` |
| [`LibTmux::Model::Pane`](https://libtmux.org/en/raku/latest/reference/libtmux-model-pane/) | A pane in a window, ID `%n` |
| [`LibTmux::Model::WindowLink`](https://libtmux.org/en/raku/latest/reference/libtmux-model-windowlink/) | A session-window association, with its index and active state |

## Typed API

- Typed objects instead of parsed format strings: [`LibTmux::Model::Pane`](https://libtmux.org/en/raku/latest/reference/libtmux-model-pane/)
- Addressing by tmux ID: [`LibTmux::Model::Pane.id`](https://libtmux.org/en/raku/latest/reference/libtmux-model-pane-id/)
- Filtering and queries over tmux objects: [`LibTmux::Model::PaneSelection.where`](https://libtmux.org/en/raku/latest/reference/libtmux-model-paneselection-where/)
- Typed errors instead of exit codes and stderr: [`X::LibTmux::InvalidFilter`](https://libtmux.org/en/raku/latest/reference/x-libtmux-invalidfilter/)

## What you get over the tmux CLI

- Connect to or start a tmux server: [`LibTmux::Server.start`](https://libtmux.org/en/raku/latest/reference/libtmux-server-start/)
- Traversal from a server down to its panes: [`LibTmux::Server.snapshot`](https://libtmux.org/en/raku/latest/reference/libtmux-server-snapshot/)
- Send keys to a pane: [`LibTmux::Model::PaneRef.send-keys`](https://libtmux.org/en/raku/latest/reference/libtmux-model-paneref-send-keys/)
- Watch for changes through tmux control mode: [`LibTmux::Server.open-control-async`](https://libtmux.org/en/raku/latest/reference/libtmux-server-open-control-async/)
- Capture pane contents: [`LibTmux::Model::PaneRef.capture`](https://libtmux.org/en/raku/latest/reference/libtmux-model-paneref-capture/)
- Arguments passed as a list, with no shell quoting: [`LibTmux::Server.command`](https://libtmux.org/en/raku/latest/reference/libtmux-server-command/)
- A typed error when the running tmux lacks a feature: [`X::LibTmux::Unsupported`](https://libtmux.org/en/raku/latest/reference/x-libtmux-unsupported/)
- Async operations: [`LibTmux::Server.snapshot-async`](https://libtmux.org/en/raku/latest/reference/libtmux-server-snapshot-async/)

- [Getting started](https://libtmux.org/en/raku/latest/guides/getting-started/): Install LibTmux, create and split panes, and find them through typed snapshots.
- [Examples](https://libtmux.org/en/raku/latest/examples/programs/): Run six complete programs against private tmux servers and compare their output.
- [tmux compatibility](https://libtmux.org/en/raku/latest/topics/compatibility/): Check the supported tmux releases and how the library handles newer ones.
- [API reference](https://libtmux.org/en/raku/latest/reference/): Native signatures, RakuDoc and links for every public module, class and method.
