Skip to content

fix: prioritize active pane in findClaudePane to show correct window - #8

Merged
MartianGreed merged 1 commit into
mainfrom
fix/active-pane-priority
Feb 6, 2026
Merged

MartianGreed merged 1 commit into
mainfrom
fix/active-pane-priority

Conversation

@MartianGreed

Copy link
Copy Markdown
Owner

No description provided.

@greptile-apps

greptile-apps Bot commented Feb 6, 2026

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

This PR improves the findClaudePane function in internal/daemon/monitor.go to prioritize the active pane when detecting Claude sessions. The change implements a two-pass search strategy: first checking if the currently active pane contains a Claude session, and only searching through all panes if the active one doesn't match.

Key changes:

  • Added first pass that checks only the active pane for Claude session
  • Existing logic moved to second pass as fallback
  • Ensures the most relevant (active) pane is detected first, improving user experience when multiple panes exist

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a straightforward optimization that adds a prioritization step before the existing fallback logic. The original logic is preserved as a second pass, ensuring backward compatibility. The implementation follows Go best practices and matches the existing code style.
  • No files require special attention

Important Files Changed

Filename Overview
internal/daemon/monitor.go Added two-pass pane detection: first checks active pane, then falls back to checking all panes if active pane isn't Claude

Sequence Diagram

sequenceDiagram
    participant M as Monitor
    participant T as Tmux Client
    participant D as Claude Detector
    
    M->>T: ListPanes(session)
    T-->>M: []Pane
    
    Note over M: First Pass: Check Active Pane
    loop For each pane
        alt pane is active
            M->>T: CapturePane(session, windowIdx, paneIdx)
            T-->>M: content
            M->>D: IsClaudeSession(content)
            D-->>M: true/false
            alt Is Claude session
                M-->>M: Return pane & content
            end
        end
    end
    
    Note over M: Second Pass: Check All Panes
    loop For each pane
        M->>T: CapturePane(session, windowIdx, paneIdx)
        T-->>M: content
        M->>D: IsClaudeSession(content)
        D-->>M: true/false
        alt Is Claude session
            M-->>M: Return pane & content
        end
    end
    
    M-->>M: Return nil if no Claude pane found
Loading

@MartianGreed
MartianGreed merged commit 24c9c83 into main Feb 6, 2026
4 checks passed
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