# pi-tmux-pane-title

A small [Pi](https://github.com/earendil-works/pi-mono) extension that keeps the current tmux pane and window titles synchronized with the Pi session name.

This makes meaningful Pi names visible in plain tmux tabs and in tools such as TWS that use `#{pane_title}` as the agent display name.

## Behavior

The extension runs on:

- `session_start` — startup, resume, fork, new session, and reload
- `session_info_changed` — `/name` and programmatic renames
- `agent_start` — repairs titles overwritten by shells or other programs before work begins

It only acts when both `TMUX` and `TMUX_PANE` are present. Empty session names are ignored. The full name becomes the pane title. If the current window contains exactly one pane, a name shortened to 36 Unicode characters becomes the tmux window/tab name. Split windows are never renamed because no single Pi session can represent the whole window.

Titles are passed directly to `tmux select-pane` and `tmux rename-window` as arguments; no shell is involved. The last meaningful titles remain after Pi exits.

## Install

From npm:

```bash
pi install npm:pi-tmux-pane-title
```

For a one-off test:

```bash
pi -e npm:pi-tmux-pane-title
```

Existing Pi processes need `/reload` or a restart after installation.

## Development

```bash
npm install
npm run check
```

Override the tmux executable for testing if needed:

```bash
PI_TMUX_PANE_TITLE_TMUX_BIN=/path/to/tmux pi
```
