Feature: Terminal focus event hook / status line refresh trigger

Resolved 💬 2 comments Opened Mar 13, 2026 by pulsedemon Closed Apr 29, 2026

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:

  1. Add a TerminalFocus hook event — Fires when the terminal window regains focus (using terminal focus reporting via ANSI escape sequences CSI I / CSI O). This would allow users to run custom scripts on focus, including refreshing status line data.
  1. 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

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗