Skip to content

Add dock icon badge for pending completion count#29

Merged
trydis merged 1 commit intomainfrom
app-icon-notifications
Mar 16, 2026
Merged

Add dock icon badge for pending completion count#29
trydis merged 1 commit intomainfrom
app-icon-notifications

Conversation

@trydis
Copy link
Owner

@trydis trydis commented Mar 16, 2026

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

  • New Features
    • The app's dock badge now displays the count of pending completions, giving you quick visibility into outstanding tasks. The badge automatically updates throughout your workflow—when completions are enqueued, when surfaces are activated or closed, and when workspaces are loaded or deleted—keeping you informed at all times.

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.
@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

The pull request adds dock badge functionality to the WorkspaceManager to display the count of pending completions. A new updateDockBadge() method is introduced and called at multiple lifecycle points including completion enqueueing, surface activation/closure, workspace loading, and workspace deletion.

Changes

Cohort / File(s) Summary
Dock Badge Update Implementation
Sources/Shellraiser/Services/Workspaces/WorkspaceManager+Completions.swift
Adds updateDockBadge() method that counts pending completions and updates the app's dock badge. Invokes this method after enqueueing a completion and when handling the .started phase of agent activity events.
Dock Badge Update Integration Points
Sources/Shellraiser/Services/Workspaces/WorkspaceManager+SurfaceOperations.swift, Sources/Shellraiser/Services/Workspaces/WorkspaceManager+WorkspaceLifecycle.swift
Integrates updateDockBadge() calls after notification cleanup in surface close/activation workflows, and after loading persisted workspaces and deleting workspaces. Adds AppKit import to WorkspaceLifecycle extension.

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding a dock icon badge that displays the count of pending completions, which is the primary objective across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch app-icon-notifications
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can suggest fixes for GitHub Check annotations.

Configure the reviews.tools.github-checks setting to adjust the time to wait for GitHub Checks to complete.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9d13df9 and 0548369.

📒 Files selected for processing (3)
  • Sources/Shellraiser/Services/Workspaces/WorkspaceManager+Completions.swift
  • Sources/Shellraiser/Services/Workspaces/WorkspaceManager+SurfaceOperations.swift
  • Sources/Shellraiser/Services/Workspaces/WorkspaceManager+WorkspaceLifecycle.swift

@trydis trydis merged commit f2c6bb5 into main Mar 16, 2026
2 checks passed
@trydis trydis deleted the app-icon-notifications branch March 16, 2026 22:04
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