tmux-tango 2.11.0

A CLI tool for managing tmux sessions - dance between your sessions!
Documentation

TmuxTango

Agent View for tmux. A TUI that lets you dance between every live tmux session — the same one-sidebar, one-key navigation Anthropic shipped for live Claude Code sessions, but for the tmux sessions you already have. Built with Ratatui for a responsive, feature-rich terminal interface.

Features

Hierarchical Tree View

  • Browse sessions, windows, and panes in an expandable tree
  • Sessions are ordered most-recently-attached first, so the ones you're actively dancing between stay at the top. Sessions never attached (e.g. created by a script with tmux new -d) sort to the bottom, alphabetically among themselves
  • 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.

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

Remote Hosts

Sessions on other machines show up in the same tree, so you jump straight into a remote agent without a manual ssh → tmux attach detour. The point is to avoid nesting: launched from a bare terminal, tango attaches to the remote tmux directly over ssh -t, so the remote server is the only tmux layer and Alt+Left brings you back to the local menu.

List the ssh aliases you want polled in ~/.config/tango/config.toml (connection details come from ~/.ssh/config as usual), or add one for a single run with tango --host <alias> — or press a in the TUI and type an alias (or user@host). Hosts added with a last until tango exits and are never written to the config, which suits a box you only visit once:

hosts = ["gpu-box", "lab"]

As soon as any host is configured the tree becomes a list of machines: your own sessions nest under an @local group and each host is a collapsible @alias group after it. With no hosts configured the tree stays flat, exactly as before.

▼ @local    (1 session)
    └── ▶ dev-agent : 3 windows (attached)
▼ @gpu-box  (2 sessions)
    ├── ▶ train     : 4 windows
    └── ▶ notebook  : 1 windows
▼ @lab      offline: ssh: connect to host lab port 22: Connection refused

The row you are on is the machine you act on. Enter attaches wherever the row lives, and n creates a session on the row's machine: on @local or any local row it is a local session; on @gpu-box or one of its sessions it runs tmux new-session over ssh and attaches there. The cursor starts on @local, so n works even when the local server has no sessions yet. A host that is still loading, offline, or has no tmux cannot take a new session; n says so instead of prompting.

  • Hosts are polled on background threads every 5 s (backing off to 60 s while unreachable), so a dead host never freezes the TUI. While a host is offline its sessions are hidden until it comes back. Status indicators and pane preview are local-only for now.
  • d kills a remote session or window over ssh (after the usual y/N confirm); rename stays local-only and shows a message on a remote row
  • Install tango (2.10+) on the remote for the full experience. If the poll finds a tango there, attach runs tango attach so the remote gets the grouped-viewer behavior and the Alt+Left detach binding (older tangos still attach, but without the binding). Without it, attach falls back to plain tmux attach-session (the node says plain tmux) and you detach with the tmux prefix + d
  • tango multiplexes its ssh connections with its own ControlMaster/ControlPersist=60s socket at ~/.ssh/tango-<hash> and uses BatchMode=yes, so keys must be loadable without a prompt (an ssh agent, or a passphrase-less key). These are passed as -o options and do not touch your own ssh config. The socket may linger up to a minute after tango exits
  • Remote tmux/tango are located by a login-shell probe and then addressed by absolute path, so a PATH that only exists in your .zprofile (Homebrew, ~/.cargo/bin) still works

CLI Subcommands

tango                    # Interactive TUI (default)
tango --host <alias>     # TUI with an extra remote host for this run (repeatable)
tango list               # List all sessions
tango attach <name>      # Attach to a session (or a window: <name>:<index>), with Alt+Left detach armed
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
tango tmux cleanup       # Remove tango's runtime tmux key bindings (crash recovery)

Getting Started

Install

cargo install tmux-tango

From Source

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

Key Action
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

Key Action
n Create new session on the selected row's machine
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

While attached to a tmux session

Key Action
Alt+Left (Option+Left on macOS) Detach back to the tango menu

The detach binding is installed for the lifetime of the tango process and only fires inside sessions tango is actively managing (@tango_active user option, set per-session before each attach). In any other session the keystroke is passed through to the active pane unchanged. If tango crashes before it can clean up, run tango tmux cleanup to remove the bindings manually.

Terminal compatibility:

  • Linux terminals (xterm, gnome-terminal, alacritty, kitty, foot, wezterm, …) — Alt+Left sends the CSI modified-arrow sequence \e[1;3D, which tmux recognizes as M-Left. Works out of the box.
  • macOS terminals (Terminal.app, iTerm2, Ghostty with default Option behavior) — Option+Left is rewritten by the terminal to the readline backward-word sequence ESC b, so tmux never sees a modified-arrow key. To handle this, tango installs a second binding on M-b that catches the rewritten form. Works out of the box.

Side effect on macOS: because Option+Left and Option+B produce the same bytes (ESC b), pressing Option+B in a shell inside an attached tango session will also detach. Ctrl+Left remains available for readline word-back. Outside tango-managed sessions the binding is a passthrough — readline word-back works normally. (On Linux this side effect only triggers if you press Option+B with "Option-as-Meta" enabled, since Option+Left sends a different sequence there.)

Terminal Compatibility

Works in:

  • Native terminals (kitty, alacritty, iTerm2, etc.)
  • SSH sessions
  • VSCode integrated terminal
  • Inside tmux sessions
  • Screen sessions

Development

Build & Test

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
  • toml (0.8) — ~/.config/tango/config.toml
  • Which (6.0) — Dependency checking
  • Anyhow (1.0) — Error handling

License

MIT License — see LICENSE file for details.