[FEATURE] Dim the TUI when the hosting terminal loses focus (xterm mode 1004)

Resolved 💬 1 comment Opened Apr 18, 2026 by jrossjones Closed May 26, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

When running multiple Claude Code sessions in parallel (VS Code split panes, tmux windows, multiple terminal tabs), it's easy to accidentally hit Enter in an unfocused session and send input to the wrong one. This is especially costly at Plan Mode's exit-confirmation prompt, where a stray Enter approves a plan and starts execution before the user has finished reading it — undermining the main safeguard Plan Mode is supposed to provide.
Vim, Emacs, tmux, and htop already use xterm focus reporting (DECSET 1004) to render differently when unfocused. VS Code's integrated terminal, iTerm2, WezTerm, Ghostty, Alacritty, and Kitty all emit CSI I / CSI O focus sequences. Claude Code just isn't consuming them visibly.

Proposed Solution

On focus-out, render the TUI in a subtly muted state (dimmed border, greyed input prompt). On focus-in, restore the active appearance.
Per #30199, the Ink-based TUI already re-renders on focus events — the event pipeline exists, it just doesn't produce a useful visual change today. Giving those re-renders a purpose would likely resolve #30199 as a side effect.

Constraints:

  • Color/opacity shift only, no layout reflow (addresses concerns in #22086)
  • Opt-in via config (e.g. tui.dimOnBlur, default off)
  • Graceful no-op on terminals that don't support mode 1004

Alternative Solutions

_No response_

Priority

Medium - Would be very helpful

Feature Category

Interactive mode (TUI)

Use Case Example

_No response_

Additional Context

Related Issues

#30199 — focus events already received but produce no visual delta; this would give them one
#22086 — users dislike current focus-driven layout changes; subtle color-only change addresses that

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗