# tmux client library for Rust

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

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

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 |
| ---- | ----- |
| [`server.Server`](https://libtmux.org/en/rs/latest/reference/server-server/) | A tmux server |
| [`session.Session`](https://libtmux.org/en/rs/latest/reference/session-session/) | A session, ID `$n` |
| [`window.Window`](https://libtmux.org/en/rs/latest/reference/window-window/) | A window in a session, ID `@n` |
| [`pane.Pane`](https://libtmux.org/en/rs/latest/reference/pane-pane/) | A pane in a window, ID `%n` |

## Typed API

- Typed objects instead of parsed format strings: [`pane.Pane`](https://libtmux.org/en/rs/latest/reference/pane-pane/)
- Addressing by tmux ID: [`target.PaneId`](https://libtmux.org/en/rs/latest/reference/target-paneid/)
- Filtering and queries over tmux objects: [`query.FilterExpr`](https://libtmux.org/en/rs/latest/reference/query-filterexpr/)
- Typed errors instead of exit codes and stderr: [`error.Error`](https://libtmux.org/en/rs/latest/reference/error-error/)

## What you get over the tmux CLI

- Connect to or start a tmux server: [`server.Server`](https://libtmux.org/en/rs/latest/reference/server-server/)
- Traversal from a server down to its panes: [`server.Server.panes`](https://libtmux.org/en/rs/latest/reference/server-server-panes/)
- Send keys to a pane: [`pane.Pane.send_keys`](https://libtmux.org/en/rs/latest/reference/pane-pane-send_keys/)
- Watch for changes through tmux control mode: [`control.ControlMode`](https://libtmux.org/en/rs/latest/reference/control-controlmode/)
- Capture pane contents: [`pane.Pane.capture`](https://libtmux.org/en/rs/latest/reference/pane-pane-capture/)
- A typed error when the running tmux lacks a feature: [`error.Error.UnsupportedCapability`](https://libtmux.org/en/rs/latest/reference/error-error-unsupportedcapability/)
- Finds the current pane from TMUX and TMUX_PANE: [`pane.Pane.from_env`](https://libtmux.org/en/rs/latest/reference/pane-pane-from_env/)
- Isolated tmux servers for tests: [`test.TestServer`](https://libtmux.org/en/rs/latest/reference/test-testserver/)
- Async operations: [`server.Server.new_session`](https://libtmux.org/en/rs/latest/reference/server-server-new_session/)

- [Quickstart](https://libtmux.org/en/rs/latest/guides/getting-started/): Install the package and run a complete program.
- [Guides](https://libtmux.org/en/rs/latest/guides/): Task guides for Rust.
- [Topics](https://libtmux.org/en/rs/latest/topics/): Subject-by-subject, with Rust in every code block.
- [Examples](https://libtmux.org/en/rs/latest/examples/): Complete programs, sourced from the code each port tests.
- [API reference](https://libtmux.org/en/rs/latest/reference/): Types and functions of the Rust API.
- [Testing](https://libtmux.org/en/rs/latest/guides/testing-with-libtmux/): Test code that uses tmux with an isolated server.
