cmux-next: a workspace can keep its own background (cx-t2x.5)

Merged
TE
24d ago
+1519-55

Bead: cx-t2x.5 (part 2 of 2, after #19942)

Right-click a workspace's background, then Change Background…. The picker now has All Workspaces | This Workspace (). It opens on All Workspaces, so Change Background… behaves as before. In This Workspace mode, the tiles preview (on dwell or focus) and save that workspace's own background: a painting, Shuffle Daily, No wallpaper, or one of your own images. Same as All Workspaces clears it. A workspace without its own background follows appearance.background as before, and the default stays plain glass.

Storage. The home daemon's personal workspace rows and the presentation store have no column a background could go in. The choice therefore lives app-side, following the pattern of TerminalThemeStore: <Application Support>/<bundle>/workspace-backgrounds.json, keyed <session>/<workspace>. The values are those of appearance.background; no second settings key is added. A migration note is on the bead and in the store's doc comment. The file survives relaunch.

How it shows. ThemeScope.pinBackdrop pins the workspace's own scope:

  • .inherit follows the app's background;
  • .none shows plain glass, even under the app's art;
  • .selection shows that background.

A room (the window's backdrop) shows the pin of the workspace it shows. A top page such as Home or Settings (show(nil)) or a workspace without a pin shows the app's background. A Shuffle Daily workspace moves on when the day, clock or time zone changes.

Ops.

  • cmux.settings.backdrop.workspace reads a workspace's background.
  • .set saves one and needs a user gesture; the value is validated by appearance.background's own accepts.
  • .preview shows one without saving; end: true drops it. Like cmux.settings.preview, it needs no gesture: a dwell is a pointer move, and closing Settings ends the preview long after the last click.

The route carries &workspace=<id>. Choose Image and Browse More Art still set All Workspaces, so they are hidden in This Workspace mode; your own images stay pickable as tiles.

Not in this PR:

  • If Settings is already a tab in another workspace of the window, opening it switches to that workspace. A This Workspace preview then lands on the workspace you right-clicked, which is no longer shown. Saving still targets that workspace correctly.
  • Per-workspace opacity and art-derived accents are still to come under cx-t2x.5.

Verification

  • Red: 1940f135 (the test alone) fails to compile on the fleet; ThemeScope has no pinBackdrop.
  • Review fixes, red then green: theWindowShowsItsShownWorkspacesBackgroundAndATopPageTheApps and the preview-without-gesture steps fail on the test-only commit and pass after the fix.
  • Green: all 202 suites of scripts/ci/run-swift-testing-suites.sh Packages/macOS/CmuxNext pass, including WorkspaceBackgroundTests. The tests cover:
    • the pin over the app's art;
    • persistence across a relaunch;
    • the value mapping;
    • the picker ops: read, preview, end, save, clear, and refusals.
  • Web: bun run check passes. bun test src/pages/settings/ test/ui-rules.test.ts test/gallery-coverage.test.ts gives 130 pass, 0 fail, including a new hostCards test for This Workspace.
  • Gallery: new variant settings / backdrops-workspace.
  • Localization: 5 new settingsWindow.backdropPicker.* strings in all 21 locales, and gen-strings was rerun.

Changelog

  • Added: Change Background… can give a workspace its own background, or keep it following all workspaces.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Lets each workspace keep its own background over the app's. Change Background… on a workspace opens the art picker with All Workspaces | This Workspace (): in This Workspace mode the tiles preview and save that workspace's own painting, Shuffle Daily, plain glass, or a custom image, while Same as All Workspaces clears it. The window shows its shown workspace's own background; top pages and unpinned workspaces follow appearance.background as before, and the default stays plain glass.

Details

  • Entries live in <Application Support>/<bundle>/workspace-backgrounds.json keyed by session and workspace, following the TerminalThemeStore pattern, and survive relaunch.
  • The picker opens on All Workspaces, so Change Background… keeps working as before until This Workspace is picked.
  • New cmux.settings.backdrop.workspace ops read, save (with a user gesture), and preview (without one) a workspace's background; values are validated by appearance.background's own accepts.
  • The Settings route carries &workspace=<id>; Choose Image and Browse More Art stay on All Workspaces and are hidden in This Workspace mode.