Add dock icon badge for pending completion count#29
Conversation
Sets NSApp.dockTile.badgeLabel at every pending-count mutation site (enqueue, agent start, activate/close surface, load/delete workspace) so the dock icon always reflects the live pending completion count.
📝 WalkthroughWalkthroughThe pull request adds dock badge functionality to the WorkspaceManager to display the count of pending completions. A new Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip CodeRabbit can suggest fixes for GitHub Check annotations.Configure the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Sources/Shellraiser/Services/Workspaces/WorkspaceManager+Completions.swift (1)
233-236: Avoid sorting when only pending count is needed.
pendingCompletionTargets()sorts the full queue; for badge count this does extra work. Consider counting directly from pane/workspace pending metadata.Lightweight count path
`@MainActor` func updateDockBadge() { - let count = pendingCompletionTargets().count + let count = workspaces.reduce(into: 0) { total, workspace in + total += workspace.rootPane.pendingCompletionCount() + } NSApp.dockTile.badgeLabel = count > 0 ? "\(count)" : nil }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Sources/Shellraiser/Services/Workspaces/WorkspaceManager`+Completions.swift around lines 233 - 236, updateDockBadge() calls pendingCompletionTargets(), which sorts the full queue unnecessarily just to get a count; replace that call with a lightweight count computed from the workspace/pane pending metadata (e.g., iterate pane.workspaces or pane.pendingCompletionFlags) instead of sorting. Modify updateDockBadge() to compute the integer count directly from the pending state source used by pendingCompletionTargets() and only call pendingCompletionTargets() (or perform sorting) where the full sorted list is actually required.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@Sources/Shellraiser/Services/Workspaces/WorkspaceManager`+Completions.swift:
- Around line 233-236: updateDockBadge() calls pendingCompletionTargets(), which
sorts the full queue unnecessarily just to get a count; replace that call with a
lightweight count computed from the workspace/pane pending metadata (e.g.,
iterate pane.workspaces or pane.pendingCompletionFlags) instead of sorting.
Modify updateDockBadge() to compute the integer count directly from the pending
state source used by pendingCompletionTargets() and only call
pendingCompletionTargets() (or perform sorting) where the full sorted list is
actually required.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6a758717-3622-434e-9636-a539648e859d
📒 Files selected for processing (3)
Sources/Shellraiser/Services/Workspaces/WorkspaceManager+Completions.swiftSources/Shellraiser/Services/Workspaces/WorkspaceManager+SurfaceOperations.swiftSources/Shellraiser/Services/Workspaces/WorkspaceManager+WorkspaceLifecycle.swift
Sets NSApp.dockTile.badgeLabel at every pending-count mutation site (enqueue, agent start, activate/close surface, load/delete workspace) so the dock icon always reflects the live pending completion count.
Summary by CodeRabbit