Skip to content

feat(sidebar): add set-indicator / clear-indicator for a workspace pill - #461

Merged
amirlehmam merged 3 commits into
amirlehmam:masterfrom
stlindenau:feat/workspace-indicator
Nov 17, 2026
Merged

amirlehmam merged 3 commits into
amirlehmam:masterfrom
stlindenau:feat/workspace-indicator

Conversation

@stlindenau

@stlindenau stlindenau commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds a small pill beside a workspace's name that a caller can set from the CLI with free text and an optional color:

wmux set-indicator [--workspace <id>] --text <text> [--color <#rrggbb|name>]
wmux clear-indicator [--workspace <id>]

Why

Today the only way for a tool to flag a state on a workspace (for example "this session runs on a remote machine") is rename-workspace. That clears titleIsDefault, so wmux stops naming the workspace from its cwd/title. set-status --workspace --text is not a substitute: it renders Done: <text> in a state-defined color and is overridden by agent activity. A workspace's customColor can only be set from the sidebar menu.

How

  • New V2 method workspace.set_indicator {workspaceId?, text, color?}; empty text clears it. Without workspaceId it resolves the caller's workspace from WMUX_SURFACE_ID.
  • WorkspaceInfo.indicator is rendered by WorkspaceRow next to the [WT] badge, using the existing workspace-row__badge styles.
  • Text is whitespace-collapsed and cut at 16 characters. color accepts #rgb, #rrggbb or a preset name; an unusable color is dropped, so the pill falls back to the accent instead of the call failing.
  • The title is never touched. The indicator is in memory only and not written to saved sessions, since whoever sets it sets it again on launch.
  • Older wmux versions reject both commands as unknown, so callers can treat a failure as "not supported".
  • docs/DEVCONTAINER.md documents the commands.

Testing

  • tests/unit/workspace-indicator.test.ts: color resolution and text normalization.
  • tests/unit/cli-indicator.test.ts: the shipped resources/cli/wmux.js against a fake pipe. set-indicator sends workspace.set_indicator with the right params, refuses blank text, and clear-indicator sends empty text.
  • tests/unit/workspace-row-indicator.test.ts: WorkspaceRow renders the pill with its text and color, nothing without an indicator, and never changes the title.
  • resources/cli/wmux.js is regenerated, so npm run verify:resources passes.
  • npm run typecheck and eslint on the touched source files are clean; verified by hand in a dev build.
  • The full vitest run has the same 25 failing files on an unmodified master and on this branch (remote-console-terminal-tap is flaky and fails intermittently on both). None are in files this change touches.
  • Not covered: the main-process workspace.set_indicator handler and the App.tsx message handler that applies it.

🤖 Generated with Claude Code

A small pill beside the workspace name, set from the CLI with free text and
an optional colour, so a caller can flag a state (for example a session
running on a remote machine) without renaming the workspace and so without
switching off wmux's own naming.

- wmux set-indicator [--workspace <id>] --text <text> [--color <#rrggbb|name>]
- wmux clear-indicator [--workspace <id>]
- workspace.set_indicator V2 method; defaults to the caller's workspace
- text is cut at 16 characters; an unusable colour falls back to the accent
- in memory only, never written to saved sessions

An older wmux rejects both commands as unknown, which callers treat as
"not supported".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@stlindenau
stlindenau marked this pull request as draft November 16, 2026 13:27
- cli-indicator: the shipped CLI against a fake pipe sends
  workspace.set_indicator with the right params, refuses blank text, and
  clear-indicator sends empty text
- workspace-row-indicator: WorkspaceRow renders the pill with its text and
  colour, nothing without an indicator, and never touches the title
- regenerate resources/cli/wmux.js, which verify:resources requires to match
  the build of src/cli/wmux.ts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@stlindenau
stlindenau marked this pull request as ready for review November 16, 2026 13:36
…lags

- The CLI read --workspace/--text/--color pairwise, so
  `set-indicator --workspace --text SSH` sent workspaceId "--text".
  Both verbs now go through flagsOrFail (amirlehmam#247).
- workspace.set_indicator answered { ok: true } whether or not any
  workspace took the pill: an unknown --workspace, a stale
  WMUX_SURFACE_ID, or a call from outside any pane all looked like
  success. Main now validates the params (-32602), asks every window
  through window.__wmux_setWorkspaceIndicator, and answers with the
  workspace that took it or -32000.
- Routed in routeSpecialV2 instead of the V2 switch, which was one
  case over sonarjs/max-switch-cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amirlehmam

Copy link
Copy Markdown
Owner

Thanks, merging this. I pushed one fix commit on top before merging:

  • The verbs read --workspace/--text/--color pairwise, so set-indicator --workspace --text SSH sent workspaceId: "--text". Both now use flagsOrFail (PowerShell: a --cmd value containing quotes is truncated and every flag after it is silently dropped (follow-up to #154) #247).
  • workspace.set_indicator always answered { ok: true }, even for an unknown --workspace, a stale WMUX_SURFACE_ID, or a call from outside any pane, which is exactly the devcontainer case this is for. Main now validates the params (-32602), asks each window through window.__wmux_setWorkspaceIndicator, and returns the workspace that took the pill or -32000. That replaced the METADATA_UPDATE broadcast and the App.tsx handler, and covers the main-side path your description listed as untested (tests/unit/workspace-indicator-rpc.test.ts).
  • Routed in routeSpecialV2, since a new case put the V2 switch over its case limit.

@amirlehmam
amirlehmam merged commit 3ee1c06 into amirlehmam:master Nov 17, 2026
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.

2 participants