Skip to content

About

Show Claude Code's live state in your tmux status bar

Resources

Stars

16 stars

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

claude-tmux-status

Show what Claude Code is doing right now, right in your tmux status bar.

When Claude is running inside a tmux window, this hook recolors that window's entry in the status bar to reflect Claude's live state — so you can tell at a glance which of your windows is busy versus waiting on you. It only changes the color; your window name is left exactly as you set it.

Demo (older version — the current hook only recolors, it no longer renames)

[0] 0:dash  1:b  2:mage  3:other  4:zsh  5:django  6:bash  7:zsh  8:zsh  9:bash*
                                                            └─ green = Claude finished, waiting on you

States

Your window name never changes — only its color in the status bar:

Style Meaning
reverse video Claude is busy — thinking or running a tool
red Claude is blocked on you — a question or permission prompt
green (dark) Claude finished; you haven't looked yet
green (light) Claude finished and you've looked at it
default Claude Code exited (styling cleared)

Red vs green. Red means Claude stopped and can't continue until you answer — it asked a clarifying question, or it wants permission to run a tool. Green means the turn is over and there's output waiting to be read. Both chime; only red is holding up work.

Seen. When Claude finishes while you're looking elsewhere, the window goes dark green. The moment you look at it — focus the terminal tab, or switch to that tmux window — it lightens to mark the output as read. That's a one-shot tmux pane-focus-in hook, which needs focus-events on; the script enables it. If Claude finishes while you're already watching, it goes straight to light green with no chime.

Cancelled turns and declined questions. Two everyday actions emit no hook event at all: interrupting Claude with Esc, and declining a question or dismissing a permission prompt. Neither produces a Stop, a PostToolUse, or anything else — the turn just ends. A window would hold its busy or red color until your next prompt repainted it, which is the one state that misreports what Claude is doing.

With no event to hook, the hook reads the screen. Claude Code's TUI footer says which mode it's in, so a watchdog polls the pane every 2 seconds:

Footer Meaning
esc to interrupt working
Enter to select · … · Esc to cancel waiting on you
? for shortcuts idle — turn is over

It paints green only on positive evidence that the idle footer is back, and only after two consecutive readings. Concluding "finished" from the mere absence of the working footer would be weaker — a dialog, a redraw, or a reworded footer would each look like the end of a turn and paint a live window green. If a release rewords the footer, the watchdog stops noticing cancels rather than guessing wrong; CLAUDE_TMUX_IDLE_MARKER and CLAUDE_TMUX_BUSY_MARKER override the strings.

It's cheap: one watcher per window, started when the window goes busy or red, and it exits the moment the window is anything else. A window sitting green has no watcher.

Background agents. The Stop event fires when the main agent finishes even if tasks launched with run_in_background are still working. The hook reads the background_tasks field from the Stop payload and, if anything is still running, keeps the window in the "busy" color and defers the chime until the last background task finishes — so it won't signal "done" early.

How it works

A single hook script, tmux-status.sh, is wired to nine Claude Code hook events (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PostToolUseFailure, Stop, StopFailure, Notification, SessionEnd). On each event it reads the payload from stdin, figures out which tmux window it's running in (via $TMUX_PANE), and sets that window's style with tmux set-window-option. It never renames the window. It's a no-op outside tmux.

All styling is applied dynamically by the script — no .tmux.conf changes are required.

Detecting "blocked on you." Two different events mean it: a Notification whose message mentions permission, and PreToolUse for the AskUserQuestion tool. The second one matters — Claude Code doesn't reliably emit a Notification when it asks a clarifying question, so PreToolUse is sometimes the only event that fires until you answer. Treating it as "busy" left the window in reverse video for the whole wait. Both events now paint red, so their order doesn't matter, and the window's state is stashed in a @claude_state window option so the second one doesn't chime again.

Clearing it. Red goes away on PostToolUse, which fires the moment you submit an answer or approve the tool. Without that event the window keeps its red until whatever repaints next — Claude's following tool call, which is however long it spends thinking first. PostToolUse reads the stored state and repaints only when the window is actually red, so it leaves a finished (green) window alone.

Sound when Claude needs you (macOS)

When Claude finishes (green) or gets blocked on a question (red), the hook can play a sound — but only if you're not already looking at that window. If your terminal is frontmost and Claude's tmux window is the active one, it stays silent; if you're in another app, or another tmux window, it chimes.

It chimes once per state change, not once per event: a question is announced by two hook events a few seconds apart, and the hook tracks the window's current state so that's one alert, not two.

It's on by default on macOS (uses lsappinfo + afplay) and a no-op elsewhere. Every setting the hook has is an environment variable, set in your ~/.claude/settings.json env block or your shell:

Variable Default Meaning
CLAUDE_TMUX_SOUND Pop A macOS system-sound name (see /System/Library/Sounds), a path to a sound file, or off to disable.
CLAUDE_TMUX_ASK_SOUND (same as CLAUDE_TMUX_SOUND) Sound for the red "needs an answer" states, so a question is audibly distinct from a finished turn. Same formats.
CLAUDE_TMUX_IDLE_MARKER ? for shortcuts Footer text meaning "idle, waiting for you to type" — how a cancelled or declined turn is detected.
CLAUDE_TMUX_BUSY_MARKER esc to interrupt Footer text meaning "Claude is working".
CLAUDE_TMUX_DEBUG (off) Path to a file; when set, every hook event the script sees is logged there.
CLAUDE_TMUX_TERMINAL_APP (auto) Comma-separated app name(s) that count as "your terminal", e.g. iTerm2 or Ghostty,Code.

CLAUDE_TMUX_TERMINAL_APP exists because tmux overwrites $TERM_PROGRAM, so the host terminal can't be auto-detected. Without it, the hook matches the frontmost app against a built-in list of common terminals (iTerm2, Terminal, Ghostty, WezTerm, Alacritty, kitty, Warp, Code, Cursor, …). Set it if you use a terminal that isn't recognized, or run more than one.

Requirements

Install

git clone https://github.com/alexose/claude-tmux-status.git
cd claude-tmux-status
./install.sh

The installer copies tmux-status.sh into ~/.claude/hooks/ and merges the required hook events into ~/.claude/settings.json (backing it up first). It's idempotent and won't duplicate entries on re-runs. Set CLAUDE_CONFIG_DIR to target a non-default config directory.

Restart any running Claude Code sessions afterward to pick up the hooks.

Manual install

If you'd rather not run the script:

  1. Copy tmux-status.sh to ~/.claude/hooks/tmux-status.sh and chmod +x it.
  2. Merge the contents of settings.hooks.json into your ~/.claude/settings.json (combine the hooks blocks if you already have one).

Uninstall

Remove the ~/.claude/hooks/tmux-status.sh entries from the hooks block in ~/.claude/settings.json (or restore a settings.json.bak.* backup the installer made), and delete ~/.claude/hooks/tmux-status.sh.

License

MIT

About

Show Claude Code's live state in your tmux status bar

Resources

Stars

16 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages