TUI switches to different layout (dashboard vs compact) on terminal focus/blur events

Resolved 💬 6 comments Opened Jan 31, 2026 by sgeraldes Closed Mar 1, 2026

Description

Claude Code's TUI switches between two completely different UI layouts based on terminal focus state. When the terminal loses focus, it shows an expanded "dashboard" view. When focus returns, it switches back to a compact view. This causes a jarring visual experience and is disruptive to the user.

Visual Evidence

Focused State (Compact View)

When the terminal has focus, Claude Code shows a minimal header:

  • Small mascot icon
  • Version info ("Claude Code v2.1.27")
  • Model info ("Opus 4.5 · Claude Max")
  • Current directory
  • Conversation history starts immediately below

Unfocused State (Dashboard/Welcome View)

When the terminal loses focus, the entire UI changes to show:

  • Large decorative box with colored border
  • "Welcome back" greeting
  • Larger centered mascot
  • "Recent activity" panel on the right (showing recent sessions)
  • "What's new" panel (showing changelog)
  • Organization name displayed prominently
  • Takes up approximately 50% of the visible terminal

Reproduction Steps

  1. Start Claude Code in any terminal (Windows Terminal, xterm.js-based terminals, etc.)
  2. Observe the compact working view
  3. Click outside the terminal window (or switch to another application)
  4. Result: The entire UI transforms into the expanded dashboard view
  5. Click back into the terminal
  6. Result: The UI switches back to the compact view

Why This Is Problematic

  1. Jarring visual experience: The entire screen content shifts when switching focus
  2. Loss of context: Users may lose their place in the conversation when the layout changes
  3. Unnecessary redraws: The full UI redraw on every focus change wastes resources
  4. Repeated triggers: In some terminal emulators (especially those with complex window hierarchies), this can trigger multiple times per focus change
  5. Distracting: Users who frequently switch between windows experience constant UI shifting

Expected Behavior

The UI layout should remain stable regardless of terminal focus state. If there's a need to indicate focus/unfocus status, it should be done with:

  • A subtle visual indicator (border color change, icon change, etc.)
  • NOT a complete UI layout transformation

Other TUI applications (vim, htop, lazygit, etc.) do not change their layout based on focus - they maintain visual stability.

Technical Context

From investigating the code, Claude Code:

  • Enables DEC Private Mode 1004 (CSI ? 1004 h) for focus event reporting
  • Receives ESC[I (focus in) and ESC[O (focus out) sequences from the terminal
  • Updates isTerminalFocused state in a React context
  • Conditionally renders different components based on this state (dashboard vs compact view)

Suggested Fix

  1. Remove the focus-dependent layout switching entirely - Show the same UI regardless of focus
  2. Or make it configurable - Add a setting like --no-focus-dashboard or in the config file
  3. At minimum, debounce the focus events - Prevent rapid switching when focus changes quickly

Environment

  • Claude Code version: 2.1.27
  • Observed in: Windows Terminal (shown in screenshots), also affects xterm.js-based terminals
  • OS: Windows 11 (also reported on macOS and Linux)

View original on GitHub ↗

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