Add setting to hide main workspaces from the sidebar
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(defaultfalse), following the existingopenLinksInAppelectron-trpc settings pattern (constant + schema column + migration + get/set procedures + settings-search registration + toggle in General settings). useDashboardSidebarDataskips 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 throughsidebarWorkspaces) 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
settingstable), 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 --noEmitpasses forapps/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
hideMainWorkspaceswithelectron-trpcget/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.