Skip to content

feat: Desktop-Shell Host-Switcher Menu — Per-Host Accent Color, Manual Reorder, Per-Host Waiting Counts - #588

Merged
sahil-noon merged 4 commits into
mainfrom
260813-1i7j-host-switcher-color-reorder-waiting
Aug 13, 2026
Merged

feat: Desktop-Shell Host-Switcher Menu — Per-Host Accent Color, Manual Reorder, Per-Host Waiting Counts#588
sahil-noon merged 4 commits into
mainfrom
260813-1i7j-host-switcher-color-reorder-waiting

Conversation

@sahil-noon

Copy link
Copy Markdown
Collaborator

Meta

Change ID Type Confidence Plan Review
1i7j feat 4.5/5.0 15/15 tasks, 26/26 acceptance ✓ ✓ 1 cycle
Impact +/− Net
raw +1332 / −38 +1294
true +852 / −27 +825
└ impl +593 / −25 +568
└ tests +259 / −2 +257

excludes fab/, docs/ · generated by fab-kit v2.20.1

Pipeline: intake ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr

Summary

The desktop shell's host-switcher dropdown renders indistinguishable rows and its list order is frozen at insertion order — yet order IS the ⌥⌘1–9 / ⇧Ctrl+1–9 accelerator map, and a waiting agent on a background host is invisible until the user switches there. This change gives each host row a left-edge bar in its instance accent color (persisted in hosts.json as an additive optional field), adds manual reordering via a hover drag grip and ⌥↑/⌥↓ keyboard moves with live accelerator-hint re-numbering, and shows each background host's cached waiting-agent count as an amber ● N. All three legs ride existing machinery (theme-color capture, badge:set caches, the id-keyed hosts.json mutator pattern); alphabetical auto-sort was explicitly rejected because it silently remaps accelerators.

Changes

  • Host color — left-edge bar (option B): ~3px accent bar per row, accentColor persisted in hosts.json with lastPath-style tolerance, hex-validated before rendering
  • Sorting — drag grip + keyboard move (options E and F): new sender-gated servers:reorder IPC channel, id-keyed array-move mutator, native menu rebuild after reorder
  • Per-host waiting count: amber ● N on background host rows, joined from view-registry badgeCount caches into the servers:list projection; dock badge stays active-host-only
  • Explicitly out of scope: rename affordance, alphabetical auto-sort, color options A/C/D, ssh tag, unreachable ⚠ state, cross-host dock-badge aggregation

@sahil-noon
sahil-noon marked this pull request as ready for review August 13, 2026 19:17
@sahil-noon
sahil-noon requested a lite review from Copilot August 13, 2026 19:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Enhances the desktop shell’s host-switcher dropdown so hosts are easier to distinguish and manage, while preserving the invariant that host list order defines the ⌥⌘1–9 / ⇧Ctrl+1–9 accelerator mapping.

Changes:

  • Persist and project per-host accentColor, render it as a left-edge accent bar (hex-validated before style interpolation).
  • Add manual host reordering (drag grip + ⌥↑/⌥↓) via a new servers:reorder IPC channel, moveHost store mutator, and native menu rebuild.
  • Join per-host background waiting counts from the view registry into servers:list, render as an amber ● N chip on non-active rows.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
fab/changes/260813-1i7j-host-switcher-color-reorder-waiting/plan.md Generated plan/acceptance criteria for the feature set.
fab/changes/260813-1i7j-host-switcher-color-reorder-waiting/intake.md Intake record describing UX decisions and constraints (accelerator-order semantics).
fab/changes/260813-1i7j-host-switcher-color-reorder-waiting/.status.yaml Change status/metadata for the fab pipeline.
fab/changes/260813-1i7j-host-switcher-color-reorder-waiting/.history.jsonl Pipeline history log entries for the change.
docs/memory/run-kit/ui-patterns.md Documents the updated switcher row model and reorder/waiting semantics.
docs/memory/run-kit/desktop-shell.md Documents hosts.json schema addition (accentColor), reorder bridge semantics, and waiting-count join.
app/frontend/src/lib/shell.ts Extends ShellServer typing/validation and adds optional reorder capability wrappers.
app/frontend/src/lib/shell.test.ts Adds tests for optional fields parsing and reorder capability degradation/behavior.
app/frontend/src/lib/shell-strip.ts Derives row model with strict hex validation and background-only waiting.
app/frontend/src/lib/shell-strip.test.ts Adds unit coverage for accent/waiting derivation rules.
app/frontend/src/components/shell-titlebar-strip.tsx Implements accent bar, waiting chip, drag + ⌥↑/⌥↓ reorder, and optimistic UI updates.
app/frontend/src/components/shell-titlebar-strip.test.tsx Adds component tests for bars/chips/reorder gestures and older-shell degradation.
app/desktop/src/preload.ts Exposes servers.reorder invoker on window.runkitShell.
app/desktop/src/main.ts Persists theme color to hosts store, adds servers:reorder, and joins waiting counts into servers:list.
app/desktop/src/hosts.ts Adds accentColor field tolerance, setHostAccentColor, and moveHost mutator; projects accentColor.
app/desktop/src/hosts.test.ts Adds tests for parsing tolerance, mutator short-circuit/no-op behavior, move/clamp, and projection rules.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +216 to +226
const current = rowsRef.current;
const from = current.findIndex((r) => r.id === dragId);
const to = current.findIndex((r) => r.id === targetId);
if (from === -1 || to === -1) return;
setServers((prev) => {
if (!prev) return prev;
const next = [...prev];
const [moved] = next.splice(from, 1);
next.splice(to, 0, moved);
return next;
});

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — onRowDragOver now resolves the from/to indexes by id inside the setServers functional updater, so batched dragover updates always splice against the exact array being updated (the ref-derived outer indexes are gone). (7e21ba0)

@sahil-noon
sahil-noon merged commit 3135c39 into main Aug 13, 2026
6 checks passed
@sahil-noon
sahil-noon deleted the 260813-1i7j-host-switcher-color-reorder-waiting branch August 13, 2026 19:49
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.

3 participants