Skip to content

Menu bar controller: separators, in-place updates, icon, tooltip, click action - #127

Open
turinglambdaai wants to merge 2 commits into
mainfrom
feat/menubar-separators-updates
Open

turinglambdaai wants to merge 2 commits into
mainfrom
feat/menubar-separators-updates

Conversation

@turinglambdaai

Copy link
Copy Markdown
Owner

Closes #119 (Swift controller half; the backend-side set-tray-menu! separator gap stays tracked by the issue).

Dogfooding from the brainfuel and movebit rewrites hit all three friction points in the issue: flat tuple menus with no separators, whole-controller reinstalls just to swap one label, and title-only status items.

API (backward compatible — the existing install(title:menuItems:) tuple form keeps working)

  • RivetMenuItem — .action(label:identifier:handler:) / .separator
  • install(title:items:) / install(icon:items:) — template NSImage status items
  • update(items:) — rebuild the menu in place
  • setItem(_:label:) — swap one entry's label
  • setToolTip(_:), setClickAction(_:) — tooltip and click-without-menu (menu stays on click-and-hold)

Verification: new RivetSystemTests/MenuBarControllerTests.swift (2 tests) covers separator layout, update/replace, single-label swap, and identifier-based action dispatch; both pass locally on arm64.

SOCK_CLOEXEC is a Linux-only socketpair flag; macOS (the dev-iteration
harness for Linux hosts) lacks it, so platform/linux/runtime did not
compile outside Linux. Fall back to setting FD_CLOEXEC on both ends
right after the pair is created — this thread performs no I/O in
between, so no descriptor can leak across an exec in that window.

Verified: the BrainFuel GTK4 host now compiles, links, and runs against
this runtime on macOS (arm64, libracketcs) with the same sources that
CI compiles on Linux.
…ck action

Evolves RivetMenuBarController along the lines of #119, keeping the
existing install(title:menuItems:) tuple API working:

- RivetMenuItem enum (action / separator) with separators rendering as
  NSMenuItem.separator(); grouping survives into tray menus.
- update(items:) rebuilds the menu in place (pause/resume style label
  swaps no longer reinstall the whole controller); setItem(_:label:)
  swaps one entry's label without touching the rest.
- install(icon:items:) puts a template NSImage in the status bar.
- setToolTip(_:) and setClickAction(_:) cover tooltip and the
  click-without-menu pattern (menu stays reachable via click-and-hold).

Covered by RivetSystemTests/MenuBarControllerTests.swift (separator
layout, update/replace, setItem label swap, action dispatch).

This branch has not been deployed

No deployments
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.

macOS RivetMenuBarController: no separators, items fixed at install, title-only (no icon/click action)

1 participant