feat(desktop): add Appearance setting to show the Workspaces sidebar tab

Closed
MA
3mo ago
+87-5

Summary

The Workspaces sidebar entry is gated behind a hardcoded constant, so today the /v2-workspaces list is reachable only through the command palette. This replaces the constant with a persisted, device-local preference and surfaces it as an Appearance → Show Workspaces tab toggle.

The default is false, so nothing changes for anyone unless they turn it on. This is deliberate — the tab was hidden on purpose in the sidebar/header reorg, and this PR is not trying to relitigate that. It just gives users who relied on the entry point a supported way back, instead of it being unreachable in a shipped build.

Closes #5881.

Motivation

Reported in #5881. apps/desktop/plans/20260721-sidebar-header-reorg-notes.md records the intent:

Workspaces tab hidden, not deleted — SHOW_WORKSPACES_TAB = false flag; flip to true to restore.

That flag is a build-time constant, so "flip to true to restore" isn't available to anyone running a released build — it requires compiling from source. Since the const is module-scope and the guards are {FLAG && …}, both blocks are constant-folded out of the production bundle entirely, so there is no in-app or patch-level workaround either. A one-bit device preference seemed like the smallest thing that closes that gap without touching the default.

How it works

  • New sidebar-workspaces-tab store (persisted zustand, renderer/stores/), mirroring the existing sidebar-workspaces-collapse sidebar store.
  • DashboardSidebarHeader reads it in place of the constant. Both gated blocks — collapsed rail and expanded row — are otherwise untouched.
  • Registered in settings-search as APPEARANCE_WORKSPACES_TAB, variant v2 (the /v2-workspaces route is a v2 concept).
  • Rendered as an Appearance section, following MarkdownStyleSection.

Nothing behind the gate changed: handleWorkspacesClick and the /v2-workspaces route were already live and are what the command palette already navigates to.

Why renderer-side and not the settings table

#5303 used the local-db tier for a comparable sidebar toggle (schema column + migration + tRPC procedures — 9 files, ~1.6k lines with the drizzle snapshot). This is purely device-local renderer UI state with no main-process consumer, so it follows the lighter MarkdownStyleSection/markdown-preferences pattern instead: no migration, no IPC. Happy to move it to the settings table if you'd rather have it alongside the other behaviour toggles — it's a contained change.

Testing

  • biome check on all changed files — clean.
  • tsc --noEmit for apps/desktop: 69 errors before, 69 after, none in the changed files. The pre-existing errors are all missing-routeTree.gen.ts route-id errors from not having run codegen locally.
  • bun test settings-search.test.ts — 8 pass / 0 fail.

No screenshot, and I want to be upfront about why rather than leave it implied: bun install fails on this machine at the @electron/rebuild step for native-keymap (headless Linux, no X11 headers), so I could not launch the desktop app. What limits the visual risk is that this PR adds no new sidebar markup — the restored button JSX is exactly the markup already in the file, and the settings row reuses the Switch + Label pattern from BehaviorSettings verbatim. Glad to add a capture if a maintainer wants one before merging.


Summary by cubic

Add an Appearance toggle to show the Workspaces tab in the sidebar, replacing the build-time flag with a device-local setting. Default is off, so existing behavior is unchanged; users can enable it to access the /v2-workspaces list from the sidebar. Addresses #5881.

  • New Features
    • Added persisted zustand store sidebar-workspaces-tab for visibility state.
    • Added Appearance → “Show Workspaces tab” switch; registered as APPEARANCE_WORKSPACES_TAB (variant v2) in settings search.
    • Sidebar header now reads the store to conditionally render the Workspaces entry; no route or handler changes.

Summary by CodeRabbit

  • New Features
    • Added an Appearance setting to show or hide the Workspaces tab.
    • The Workspaces tab visibility preference is saved and applied throughout the sidebar.
    • Added the setting to Appearance search results with descriptive help text.
    • Sidebar layouts now consistently reflect the selected visibility preference.