Skip to content

terminal: tab icon follows the focused pane's agent - #1018

Merged
onevcat merged 1 commit into
mainfrom
feat/tab-icon-follows-focused-agent
Nov 1, 2026
Merged

onevcat merged 1 commit into
mainfrom
feat/tab-icon-follows-focused-agent

Conversation

@onevcat

@onevcat onevcat commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Depends on #1017. The base branch is that PR's branch, so this diff shows only the focus change.

Problem

A tab has one icon but can hold several panes. The icon keeps the last value written:

  • A Claude pane can show the Git icon from the split beside it, after focus returns to Claude.
  • An agent detected in an unfocused split never reaches the tab, even after that split takes focus.

Change

recordActiveSurface is the point that both programmatic focus and the surface focus callback go through. It now applies the agent's icon when the newly focused pane has a detected agent. Lookup order is the same as for detection: process name, then agent.

Focus moves to Tab icon
Pane with a detected agent That agent's icon
Pane without an agent No change; the pane's next recognised command sets the icon
Any pane, with a user icon or a script icon set No change

The change uses applyResolvedIcon, so the lock rules are the same as for titles and detection. Script icons also stay, because the documented precedence is auto < script < user.

Verification

  • 8 new tests in WorktreeTerminalStateTabIconTests. 5 failed without the focus call. All 21 tests in the suite pass with it. The others are control cases for plain panes and locked icons.
  • make check, make test (prowl-tests 5049 passed, 0 failed, 11 skipped), and make build-app pass.
  • Manual run with real Claude and Codex in isolated Debug instances, using prowl focus. Evidence is from window screenshots, because prowl list has no icon field.

Left split: Claude. Right split: plain shell. The steps, top to bottom: run git log on the right, focus left, focus right.

Before (only #1017): the Git icon stays on the Claude pane.
Tab bar before the change

After: the icon returns to Claude on focus, and stays Claude when focus moves to the plain pane.
Tab bar after the change

Left split: Claude. Right split: Codex, detected while unfocused. The steps, top to bottom: before focus, focus right, focus left.
Tab bar with two agents

Not tested manually: focus by mouse click (a unit test calls the surface focus callback directly), and user or script icons (unit tests only).

@onevcat
onevcat added this pull request to stack #1019 October 31, 2026 08:03
@onevcat
onevcat force-pushed the feat/tab-icon-follows-focused-agent branch from a7da134 to b0a1c8d Compare October 31, 2026 13:24
Base automatically changed from fix/agent-title-tab-icon to main October 31, 2026 13:27
A tab has one icon but can hold several panes. The icon kept the last value
written, so a Claude pane could show a Git icon from the split beside it, and
an agent detected in an unfocused split never reached the tab.

Apply the agent's icon when focus moves to its pane. User and script icons
stay. A pane without an agent does not follow focus: it has no record of its
current command, so its next command decides.
@onevcat
onevcat force-pushed the feat/tab-icon-follows-focused-agent branch from b0a1c8d to 7e4d724 Compare October 31, 2026 13:27
@onevcat
onevcat merged commit 93933da into main Nov 1, 2026
1 check passed
@onevcat
onevcat deleted the feat/tab-icon-follows-focused-agent branch November 1, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant