Feature: Terminal focus event hook / status line refresh trigger
Feature Request
Problem
The status line currently only updates after specific Claude Code lifecycle events (new assistant message, permission mode change, vim mode toggle). There is no way to trigger a status line refresh when the user returns focus to the terminal window.
This means if external state changes while the user is in another window (e.g., git status changes, time passes, background processes complete), the status line remains stale until the next Claude interaction.
Proposed Solution
One or both of:
- Add a
TerminalFocushook event — Fires when the terminal window regains focus (using terminal focus reporting via ANSI escape sequencesCSI I/CSI O). This would allow users to run custom scripts on focus, including refreshing status line data.
- Expose an external trigger for status line refresh — A mechanism (e.g., a signal, IPC, or CLI command like
claude --refresh-statusline) that external processes or terminal focus callbacks can invoke to force a status line update without requiring a Claude interaction.
Context
Many terminal emulators (iTerm2, Kitty, WezTerm, modern xterm) support focus event reporting via DECSET 1004. Claude Code could opt into receiving these events to detect when the user returns to the terminal.
This would make the status line feel more "alive" — showing current git status, updated context usage, or custom user data immediately when the user switches back to the Claude Code terminal.
Alternatives Considered
- Periodic polling via
/loop— Works but is noisy and wasteful - Terminal-side scripts — Terminals can run commands on focus, but there's no API to poke Claude Code's status line from outside
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗