Draw shared sizing bounds in the divider color; add Connected Devices… on iOS
Summary
Follow-up to https://github.com/manaflow-ai/cmux/pull/15203. On a dark theme the hatched area outside a shared terminal's grid read as a lighter surface with a brighter border than the split divider next to it, because the contrast palette forced lines to 3:1 and hatch toward the foreground. The sizing chrome now uses the divider's own gray:
- Mac: grid border and chip outline use the workspace's split divider color (new
BonsplitConfiguration.Appearance.splitDividerColor, from https://github.com/manaflow-ai/bonsplit/pull/267), the hatch is that color at 60% over the terminal background with no fill, and the chip is filled with the terminal background. Only chip text keeps a 4.5:1 floor. - iOS: the same rule with
UIColor.separator, resolved in the appearance the terminal chrome uses for the theme (TerminalSizingChromePalette). - iOS: the terminal title menu gains Connected Devices… (subtitle "2 others" / "Only this device"). It shows whenever the Mac published a size state, so the size sheet is reachable while sizes match and the chip is hidden. The chip and the menu item share
presentTerminalSizeSheet(). Menu item placement follows the HIG Menus page (https://developer.apple.com/design/human-interface-guidelines/menus): a secondary action in the document title menu, with a subtitle for status.
Tab avatars and the size panel/sheet avatars keep the existing contrast palette. docs/shared-terminal-sizing.md describes both changes.
Merge https://github.com/manaflow-ai/bonsplit/pull/267 before this PR so the submodule SHA is on bonsplit main.
Multi-Mac sizing and disconnecting a Mac (this round)
- Disconnect a Mac's view, tmux-style. A phone (or a viewing Mac) can now disconnect a Mac. Only that Mac's view detaches: its pane shows the Detached card with Reattach / Reattach as viewer, stops counting and drops keyboard and text input, while the terminal and every other viewer, including the phone that asked, keep their sessions.
- Local terminal:
LocalTerminalSizingHostlets another participant detachmac:<surface>; the PTY stays and the pane keeps its latest grid for the reattach. This Mac's own UI still cannot disconnect itself. - Cloud terminal: new daemon capability
sizing-view-detach-v1.detach-clientnaming a capable client's own view (now scoped withsurface) detaches only that view (detached {scope:"view"}); the connection, its byte stream and its relayed phones stay, andreattach-view {surface, counts?}restores it without reconnecting. Clients without the capability are still kicked whole. Against an older daemon the Mac refuses a request to disconnect its own view rather than drop the relay. - iPhone: Mac rows in the size sheet offer Disconnect with a confirmation naming the Mac ("Disconnect Lawrence's MacBook Pro?"), following the HIG Alerts page for destructive actions (https://developer.apple.com/design/human-interface-guidelines/alerts).
- Local terminal:
- Two Macs of one user. Participants carry a stable per-install
device_id(Mac: one-way digest of its host device id; iPhone: vendor id; TUI: host name). Priority keys become<user or anon:id>/<device_kind>/<device_id>; a legacy two-segment entry still matches every device of that kind, and size panels migrate legacy entries to per-device keys on the next edit. A phone now defers only to a Mac or TUI of its user that itself counts. - Macs viewing another Mac's terminals. Devices mirrors (
DeviceTerminalMirrorSession) existed but never joined the host's sizing. A viewing Mac is now a participant like a phone (device_kind: mac, own name and id, same counts rules, chip and bounds in its pane, disconnect and reattach, size panel actions through the host's mobile RPC). Under Fit everyone a smaller viewing Mac therefore shrinks the host grid, as a phone does. - Builds on https://github.com/manaflow-ai/cmux/pull/15792 (merged): each Cloud pane pins its Ghostty grid to the daemon grid, so each Mac renders the host grid exactly with its own chip.
docs/shared-terminal-sizing.mddocuments host vs relay vs view, who may disconnect whom,device_id, the priority key and the view-only detach protocol.
Relay authorization: no RemoteRelayCommandPolicy allowlist change. The new daemon command and capability are cmux-tui control-socket protocol, not v2 socket methods, and no command-bearing parameter was added.
Testing
- bonsplit
swift test:BonsplitSizingChromePaletteTestsred then green (bonsplit e48d6ba, be5e793). One unrelated failure,TabBarDropHandlerTests.testTranslatedDestinationHitTestsInSuperviewCoordinates, also fails on the base bonsplit SHA. CmuxMobileTerminalKitswift test(Xcode 26.3):TerminalSizingChromePaletteTestsred then green (d37814a, 69672bf); 213 tests pass.CmuxMobileShellModelswift test:MobileTerminalConnectedDevicesMenuItemTestsred then green (e1fb2d6, b28634f); 427 tests pass.swift build --triple arm64-apple-ios17.0-simulatorforCmuxMobileTerminalandCmuxMobileShellUI: compiles.python3 scripts/verify-local.py: 16/16 pass.scripts/localization_catalog.py check: 0 parity errors. New iOS keys carry all nine locales, with plural variations for the count.- Theme proofs (Mac: light, dark, Solarized Light, Dracula and more; iOS: same set) were regenerated and reviewed. The Mac proof draws a real split divider beside the pane for comparison. The iOS proof uses
UIColor.separator's documented light/dark values, since UIKit does not run in the macOS test host. - Not verified here: the Mac app compile (fleet build pending) and live behavior in a tagged Mac or iPhone build.
This round (regression tests committed before each fix):
- Fixtures in
schemas/terminal-sizing/fixtures.json(per-device priority, legacy keys, deferral to a counting Mac, relay Mac's view leaving): red then green on the Swift engine (swift test, 85ec6fa → 42684f7) and cmux-tuisizing_policy(hostedverify-cmux-tui-hosted.sh --filter sizing, linux test + lint green at 177cd17). - Daemon:
detaching_a_relay_macs_own_view_keeps_its_connection_and_phones,detach_client_kicks_a_client_without_view_detach(f861ae5 → c1b79bc); hosted--filter detachlinux green. CmuxTerminalSharingswift test(61 tests): Mac view detach and reattach, store authorization, relay view-only route,RemoteMacTerminalViewer.CmuxCloudTuiswift test(20): capability, decoder, commands.CmuxTerminalSizing(5): legacy key migration.CmuxMobileShellModel(431): Mac-row disconnect confirmation, device_id in viewport params.- Fleet builds: macOS app at fbd345a (job 794d0589bb1d7b55932dcb12, done); iOS simulator + device archive at fbd345a (job ccdca3e505a993af711571a6, done).
python3 scripts/verify-local.py16/16; localization catalog 0 parity errors.- E2E on dev Cloud VM vm-b7874e3610b2465b80f8a5e986f792f7 upgraded in place to cmux-tui 177cd17: two raw Mac clients of one user (200×60 and 100×30) plus a phone sub-view. Fit everyone chose 100×30; keys
u_e2e/mac/studioandu_e2e/mac/laptop; the phone deferred under latest; priority onu_e2e/mac/laptopheld the grid against the other Mac's activity; the phone-forwarded self detach returnedscope:"view", delivereddetached {scope:"view"}, kept the connection and the phone sub-view, ignored the detached view's resize, andreattach-view counts:falserestored it as a viewer. Test workspaces were closed. - Not verified: live Mac GUI with two tagged Mac apps on one Cloud terminal (
cmux surface participantson each), the Detached card and input gate in a running app, Devices Mac-to-Mac viewing live, cmuxTests (CI), macOS hosted Rust job.
Changelog
Changed: Shared terminal bounds (border, hatch and size chip outline) use the same gray as split dividers on Mac and iPhone.
Added: Connected Devices… in the iPhone terminal title menu opens the terminal size sheet at any time.
Added: A phone or another Mac can disconnect a Mac's view of a shared terminal; the terminal and other viewers keep running, and the Mac can reattach from its pane.
Changed: Two Macs of the same person rank separately in shared terminal priority, and a Mac viewing another Mac's terminal now counts toward its size like a phone.
🤖 Generated with Claude Code
Summary by CodeRabbit
- New Features
- The workspace title menu now shows connected-device counts and opens the terminal size sheet when sizing information is available.
- Shared terminals support multiple Mac viewers and per-device sizing identity. A Mac’s view can be detached and reattached without disconnecting the terminal or its relayed devices.
- Mac participants can be disconnected from the size sheet with a device-specific confirmation. Detached views stop receiving input until reattached.
- Improvements
- Terminal sizing indicators use divider-based borders and hatching, with improved chip text contrast.
- Legacy priority settings continue to work alongside per-device ordering.
- Documentation
- Updated guidance for shared terminal sizing and connection behavior.