# TmuxTango
A modern TUI for managing tmux sessions — dance between your sessions! Built with Ratatui for a responsive, feature-rich terminal interface.
## Features
### Hierarchical Tree View
- Browse sessions, windows, and panes in an expandable tree
- Lazy-loaded children — only fetched when you expand a node
- Split-panel layout: tree (left) + pane content preview (right)
### Real-Time Status Monitoring
Colored indicators show pane status at a glance:
- **Yellow** `●` — Waiting for input (Y/n prompts, interactive menus, permission requests)
- **Red** `●` — Error detected (build failures, panics, tracebacks)
- **Green** `●` — Active process running
- **Gray** `○` — Idle at shell prompt
- **Gray** `?` — Unknown
Session and window indicators aggregate from child panes (worst status wins).
### Claude Code Integration
TmuxTango has first-class support for monitoring Claude Code panes via [Claude Code hooks](https://docs.anthropic.com/en/docs/claude-code/hooks).
**On first launch, TmuxTango automatically installs lightweight hooks into `~/.claude/settings.json`** that write pane status to `/tmp/tango-status/`. The hook script itself is placed at `~/.config/tango/status-hook.sh`. This gives reliable, event-driven detection of whether Claude is working (green), waiting for permission (yellow), or idle (gray) — no polling of pane content needed.
- Hooks are installed silently with no prompts
- If installation fails (e.g., no `~/.claude/` directory), TmuxTango falls back to content-based heuristics
- Existing Claude Code sessions must be restarted to pick up the hooks
- Manage hooks manually with `tango hooks install`, `tango hooks uninstall`, or `tango hooks status`
### Session Management
- Create, rename, and kill sessions/windows/panes
- Smart attachment: uses `switch-client` inside tmux, `attach-session` outside
- Pane content preview with full ANSI color support
### CLI Subcommands
```bash
tango # Interactive TUI (default)
tango list # List all sessions
tango attach <name> # Attach to a session
tango kill <name> # Kill a session
tango new [name] # Create a new session
tango rename <old> <new> # Rename a session
tango hooks install # Install Claude Code status hooks
tango hooks uninstall # Remove hooks from Claude Code settings
tango hooks status # Show hook installation status
```
## Getting Started
### Install
```bash
cargo install tmux-tango
```
### From Source
```bash
git clone https://github.com/kylebeggs/TmuxTango.git
cd TmuxTango
cargo install --path .
```
### Requirements
- **tmux** — the only runtime dependency
- **Rust 1.70+** — for building from source
## Keyboard Shortcuts
### Tree Navigation
| `j/k` or `↑/↓` | Navigate up/down |
| `Tab` or `Space` | Expand/collapse node |
| `h` or `←` | Collapse or go to parent |
| `l` or `→` | Expand or enter child |
| `Enter` | Attach to selected target |
### Actions
| `n` | Create new session |
| `r` | Rename session/window |
| `d` or `x` | Kill (with confirmation) |
| `p` | Toggle preview panel |
| `s` | Toggle status monitoring |
| `J/K` | Scroll preview up/down |
| `q` or `Esc` | Quit |
## Terminal Compatibility
Works in:
- Native terminals (kitty, alacritty, iTerm2, etc.)
- SSH sessions
- VSCode integrated terminal
- Inside tmux sessions
- Screen sessions
## Development
### Build & Test
```bash
cargo build # Debug build
cargo build --release # Release build
cargo test # Run all tests
cargo test -- --nocapture # With output
```
### Tech Stack
- **Ratatui** (0.28) — TUI framework
- **Crossterm** (0.27) — Terminal backend
- **Clap** (4.5) — CLI argument parsing
- **Serde/Serde JSON** (1.0) — Claude Code settings.json manipulation
- **Which** (6.0) — Dependency checking
- **Anyhow** (1.0) — Error handling
## License
MIT License — see LICENSE file for details.