# tmux client library for TypeScript

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

> tmux client library for TypeScript. 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/ts/latest/reference/server-server/) | A tmux server |
| [`session.Session`](https://libtmux.org/en/ts/latest/reference/session-session/) | A session, ID `$n` |
| [`window.Window`](https://libtmux.org/en/ts/latest/reference/window-window/) | A window in a session, ID `@n` |
| [`pane.Pane`](https://libtmux.org/en/ts/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/ts/latest/reference/pane-pane/)
- Addressing by tmux ID: [`common.PaneId`](https://libtmux.org/en/ts/latest/reference/common-paneid/)
- Filtering and queries over tmux objects: [`selection.Selection.where`](https://libtmux.org/en/ts/latest/reference/selection-selection-where/)
- Typed errors instead of exit codes and stderr: [`errors.LibTmuxError`](https://libtmux.org/en/ts/latest/reference/errors-libtmuxerror/)

## What you get over the tmux CLI

- Connect to or start a tmux server: [`server.Server`](https://libtmux.org/en/ts/latest/reference/server-server/)
- Traversal from a server down to its panes: [`server.Server.panes`](https://libtmux.org/en/ts/latest/reference/server-server-panes/)
- Send keys to a pane: [`pane.Pane.sendKeys`](https://libtmux.org/en/ts/latest/reference/pane-pane-sendkeys/)
- Watch for changes through tmux control mode: [`server.Server.watch`](https://libtmux.org/en/ts/latest/reference/server-server-watch/)
- Capture pane contents: [`pane.Pane.capture`](https://libtmux.org/en/ts/latest/reference/pane-pane-capture/)
- Arguments passed as a list, with no shell quoting: [`server.Server.cmd`](https://libtmux.org/en/ts/latest/reference/server-server-cmd/)
- A typed error when the running tmux lacks a feature: [`errors.VersionTooLowError`](https://libtmux.org/en/ts/latest/reference/errors-versiontoolowerror/)
- Async operations: [`server.Server.newSession`](https://libtmux.org/en/ts/latest/reference/server-server-newsession/)

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