Add setting to hide main workspaces from the sidebar

Closed
AR
5mo ago
+1610-0

Summary

This PR adds a "Hide main workspaces" toggle (General settings) that removes the auto-included main (default-branch) workspace from the sidebar. The main workspace still exists — this only gates its sidebar visibility — so worktree-only users can keep exactly one sidebar entry per task.

Closes #5302.

Motivation

For worktree-only workflows the per-project main workspace is just noise: the default branch is never touched directly, so the entry has to be closed manually for every project — and closing it doesn't stick (the local record is removed but the startup sweep re-adds it on next launch). This gives a durable, device-local opt-out.

How it works

Rather than blocking creation of the main workspace (which is a hard invariant tied to project creation, the cloud contract, and the startup sweep), this gates visibility at the sidebar layer:

  • New device-local setting hideMainWorkspaces (default false), following the existing openLinksInApp electron-trpc settings pattern (constant + schema column + migration + get/set procedures + settings-search registration + toggle in General settings).
  • useDashboardSidebarData skips the auto-included main workspaces when the setting is on. Mains the user explicitly placed in the sidebar (those with a local-state row, flowing through sidebarWorkspaces) are unaffected.

Because the main workspace is untouched in the DB/cloud, nothing about project creation, the main-workspace sweep, or worktree creation changes.

Tradeoffs

  • The setting is device-local (stored in the local settings table), consistent with other behavior toggles — it does not sync across machines.
  • Tagged as a v2-only setting since the auto-included main workspace is a v2-sidebar concept.

Testing

  • tsc --noEmit passes for apps/desktop.
  • Biome check passes on changed files.
flowchart TD
    A[v2Workspaces: type=main] --> B{hideMainWorkspaces?}
    B -- false --> C[auto-include in sidebar]
    B -- true --> D[skip auto-include]
    E[Explicitly placed mains<br/>local-state row] --> F[always shown via sidebarWorkspaces]

Summary by cubic

Adds a "Hide main workspaces" toggle in Behavior settings to hide auto-included main (default-branch) workspaces from the sidebar. The main workspace still exists; this only hides its auto-added sidebar entry. Closes #5302.

  • New Features
    • New toggle in Behavior settings to hide auto-included main workspaces from the sidebar.
    • Explicitly added main workspaces remain visible; default is off and stored locally.
    • Introduces hideMainWorkspaces with electron-trpc get/set, local DB column + migration, and settings search (v2 only).

Summary by CodeRabbit

  • New Features
    • Added a "Hide main workspaces" toggle in Behavior settings. When enabled, main workspaces will no longer appear in the sidebar, allowing for a cleaner workspace view.