Skip to content

feat(terminal): show spinner on tabs with running child processes - #107

Merged
honerlaw merged 1 commit into
mainfrom
worktree-idle-icon
Mar 18, 2026
Merged

honerlaw merged 1 commit into
mainfrom
worktree-idle-icon

Conversation

@honerlaw

Copy link
Copy Markdown
Contributor

Summary

  • Emit terminal-busy-{id} events from the existing Rust CWD polling loop when a terminal's busy state changes (zero extra cost — reuses the get_child_pid call already happening every 2s)
  • Frontend subscribes to busy events, stores state in busyMap on the terminal store, and TerminalTabLabel renders a spinning icon when the terminal has an active child process
  • Works in both the global backgrounded tab bar and per-pane split view tabs

Test plan

  • Open 2+ terminal tabs
  • Run a long process (e.g., sleep 10) in one tab — its tab should show a spinner
  • The other idle tab should have no spinner
  • When sleep finishes, the spinner should disappear within ~2 seconds
  • Verify in both tab bar locations: backgrounded tabs (global bar) and per-pane tabs (split view)

Review Notes

Deferred low/medium issues (no action needed):

  • Low: Possible orphaned busyMap entry if a stale busy event arrives after tab removal — single boolean, no visible side effects
  • Medium: The isTerminalBusy IPC command (used by close-tab confirmation) could be replaced with a synchronous busyMap read, but the 0-2s polling lag makes the IPC call more accurate for that use case

🤖 Generated with Claude Code

Emit terminal-busy-{id} events from the existing CWD polling loop in
the Rust backend when a terminal's busy state changes. The frontend
subscribes to these events, stores busy state in a busyMap on the
terminal store, and TerminalTabLabel renders a spinning icon when the
terminal has an active child process.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@honerlaw
honerlaw merged commit f9ae1e6 into main Mar 18, 2026
2 checks passed
@honerlaw
honerlaw deleted the worktree-idle-icon branch March 18, 2026 03:32
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