remote-tmux: tint remote workspace sidebar rows by host (origin colors, beta)

Closed
EJ
1mo ago
+1740-209

What this adds

Per-host origin colors for remote workspaces: tint each remote/mirror workspace's sidebar row with a stable color derived from its host, so sessions from different hosts are easy to tell apart at a glance and a given host shows the same color in every window. A user's manually chosen workspace color always wins. Off by default behind remoteTmux.originColors.beta.

A second beta setting, remoteTmux.originHostTitles.beta, covers the case color alone does not: sidebar workspaces that share a title but come from different places. Each remote one shows its host after the title, without the domain the hosts have in common. Also off by default.

How it works

  • RemoteHostColorRegistry assigns each destination a palette slot: a stable FNV-1a hash of the host name picks a start index, then linear-probes to the next free slot on collision, and caches the assignment. The stable hash (not Swift's per-process Hasher) keeps a lone host's color steady across launches. The registry is owned by RemoteTmuxController (itself owned by AppDelegate at the app seam) and reached through it — no ambient singleton.
  • Snapshot plumbing: the sidebar snapshot gains customColorHex (effective color = manual color ?? origin color) and hasManualCustomColor (so "Clear Color" only shows for a real manual color). Resolved above the row boundary; mirror workspaces carry their host through the session mirror (via hostDestination), so it works even without a remoteConfiguration.
  • Toggling the flag re-evaluates the sidebar and repopulates the snapshot cache.
  • Settings: a Beta Features toggle plus a curated search entry so it's findable.

Tests

RemoteHostColorRegistryTests (stable-hash determinism, collision probing, full-palette fallback, empty-palette nil), SidebarWorkspaceSnapshotRefreshPolicyTests (color feeds the presentation key / cache invalidation), the AppKit row-cell snapshot test updated for the new fields, and RemoteHostTitleSuffixesTests for the host suffix (only the part that tells the hosts apart is shown, a remote workspace beside a local one shows its whole host, and a host is never trimmed to nothing).

Changelog

Added: Beta settings that tint each remote tmux workspace row in the sidebar with a stable color per host, and show the host after workspace titles that would otherwise be identical

Summary by CodeRabbit

  • New Features

    • Added a beta setting for Remote host colors (localized UI + search entry).
    • When enabled, remote tmux sidebar rows use stable per-host “origin” colors, including mirror-aware origin tinting.
    • Effective colors now participate in sidebar rendering/snapshot identity, ensuring consistent updates.
  • Bug Fixes

    • Sidebar workspace color rendering and snapshot refresh now immediately reflect the toggle and “Clear Color” behavior, including while the context menu is open.
  • Tests

    • Added coverage for deterministic per-destination color slotting (including collisions/exhaustion) and for effective color snapshot identity.