Skip to content

Refactor(ui): Refactor desktop shell chrome controls - #399

Merged
Astro-Han merged 2 commits into
apache:mainfrom
MicroGery:ui-shell-chrome-surfaces
Jul 1, 2026
Merged

Astro-Han merged 2 commits into
apache:mainfrom
MicroGery:ui-shell-chrome-surfaces

Conversation

@MicroGery

Copy link
Copy Markdown
Contributor

Summary

Refs #390

This PR refactors the desktop shell chrome so top-level window/sidebar controls have a single owner and stable geometry across sidebar states.

Changes

  • Remove the native Electron application menu via Menu.setApplicationMenu(null).
  • Split desktop shell chrome into dedicated ShellChrome and WorkspaceSurface components.
  • Move search, sidebar expand/collapse, and collapsed-state new-task controls into one shell-level topbar rail.
  • Use shared CSS variables for topbar button size, gap, top offset, and left offset.
  • Remove duplicate sidebar-header controls from SessionListPanel.
  • Update Storybook and contract tests for the new shell chrome ownership model.

Verification

  • npm --workspace @maka/ui run build
  • npm --workspace @maka/desktop run build:main
  • npm --workspace @maka/desktop run build:renderer
  • node --test apps/desktop/dist/main/__tests__/app-shell-chrome-contract.test.js
  • node --test apps/desktop/dist/main/__tests__/sidebar-topbar-rail-contract.test.js
  • node --test apps/desktop/dist/main/__tests__/search-modal-lifecycle-contract.test.js
  • node --test apps/desktop/dist/main/__tests__/storybook-baseline-contract.test.js

@MicroGery
MicroGery force-pushed the ui-shell-chrome-surfaces branch from aeedcf9 to cef5cd7 Compare July 1, 2026 09:12
@Astro-Han
Astro-Han merged commit 5d696e4 into apache:main Jul 1, 2026
Astro-Han added a commit that referenced this pull request Aug 4, 2026
…command routing (#2098)

* fix(desktop): restore the native macOS application menu

PR #399 removed the Electron application menu (Menu.setApplicationMenu(null)),
which on macOS leaves Cmd+Q and the Edit roles without any handler — quitting
was impossible via keyboard and closing the window left the Dock tile lit.

Rebuild a platform-appropriate menu from native roles and route its commands
through the existing renderer actions over one typed channel:

- New application-menu.ts builds a darwin-only template: App (About, Settings,
  Services, Hide, Quit), File (New Task, Close), role-based Edit/Window, an
  explicit View menu with Reload/DevTools gated on isPackaged, and Help with
  a Keyboard Shortcuts entry. Non-darwin keeps setApplicationMenu(null) so
  Windows/Linux shell chrome and Ctrl+N / Ctrl+, behavior are untouched.
- Menu commands dispatch over window:command (newTask | openSettings |
  openHelp); the renderer already owns those implementations in
  app-shell-effects.ts, which subscribes in the existing mount effect.
- Menu accelerators are the single active owner on macOS: AppKit resolves
  menu key equivalents before the web contents sees the keydown, so the
  renderer useHotkeys entry never also fires.
- The menu installs once at whenReady (app-scoped, survives window close)
  instead of inside createWindow; dispatch re-creates the window when none
  exists.

Verified: 1592 desktop main tests pass (6 new menu tests), typecheck clean,
and on a real macOS dev run the menu bar shows App/File/Edit/View/Window/Help
with Settings… under About, New Task under File, dev-only Reload/DevTools,
and menu-click Quit exits through the quit coordinator.

Closes #2088

* refactor(desktop): address menu PR review feedback

- Derive ApplicationMenuCommand from the preload WindowCommand contract so
  the two sides of the window:command channel cannot silently drift.
- Drop the unused labels injection point (dead abstraction; English labels
  are the documented decision).
- Lock the renderer-side routing with a stability-contract case: the
  window-command subscription must not duplicate across rerenders and must
  dispatch newTask/openSettings/openHelp to the existing actions.
- Note the deliberate command drop when no window exists next to the
  dispatch branch.
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