Repository navigation
Conversation
The Mac app showed one server at a time, and moving to another machine meant Switch Server and a fresh connect. Now every server gets a tab in the title bar, and every tab stays live. - Tab strip: a small bundled page (assets/tabs.html) in its own web view across the top of the window, with the traffic lights inset into it. Each tab has a colour and a status badge: a red count when sessions need you, an amber dot when they are waiting, a blue ring while they work, a dashed circle while the server does not answer. - The status comes from the app, not from the page: one thread per tab reads GET /api/sessions every 2 seconds (macOS stalls hidden web views), backs off for 60 s on a 429 and stops on 401/403, so a wrong password is never retried in a loop. - + or ⌘T opens the connect screen in a new tab. A server that is already open just brings its tab forward instead of opening twice, also when two connects race (checked again when the probe ends). - Double-click or the right-click menu renames a tab; the same menu sets the colour, reloads, reconnects, closes, or closes the others. Tabs can be dragged. A new Server menu carries ⌘T, ⌘W, ⇧⌘T (reopen closed tab, last 10), ⌘0, ⇧⌘[ / ⇧⌘] and ⌘1 to ⌘8 (⌘9 is the last tab once there are nine). Close Window moves to ⇧⌘W. Ctrl+Tab and Alt+1..9 stay with Codeman's own session switching. - ⌘0 shows every server at once (assets/overview.html): the ones that need you first, up to four sessions each with what they ask, and a click on a session opens its tab and selects it. - Tabs are saved in desktop.json (tabs, activeTab) and come back at launch, connecting by themselves when auto-connect is on. - Logins: each tab keeps its own Basic credentials, and a challenge is answered only with the login of the tab whose web view asked (macos.rs binds each WKWebView to its tab). - Cookies: on macOS 14 and later every server gets its own WebKit data store (WKWebsiteDataStore dataStoreForIdentifier, with a stable id hashed from the server URL), so a server on port 3000 and a beta on 5000 of the same host cannot log each other out. Before macOS 14 a second tab on a host that is already open is refused with a message. The server used last before this change keeps the default store, so its per-device settings (font size, skin) survive; every other server starts those fresh once. - The lid logo blink watches all open servers, and Keep This Mac Awake follows the tab that runs on this Mac. New pure model in src/tabs.rs (names, colours, order, shortcuts, strip and overview state) with unit tests; agents.rs reads the per-session detail for the badges and the overview; policy.rs parses the strip and overview IPC and refuses it from any other frame. Browser tests drive both bundled pages (test/desktop-tabs-pages.browser.test.ts) and the connect page's restored-tab path. Not yet run in a real window: the Mac mini has no screen session. The owner checks the traffic-light placement, clicks under the transparent title bar, window drag and zoom from the strip, keyboard focus after strip clicks, and two logged-in servers side by side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Codeman for Mac (
packages/desktop, the native app: Rust, tao + wry/WKWebView + muda) showed one Codeman server at a time. Anyone with several machines (a Mac, a home server, a build box) had to use Switch Server and connect again each time. This PR gives every server its own tab in the window's title bar, and every tab stays live, so switching is one click.+or ⌘T opens the connect screen in a new tab. A server that is already open brings its tab forward instead of opening a second copy.desktop.jsonand come back at launch, connecting by themselves when auto-connect is on.How it works
assets/tabs.html) in its own child web view across the top. Each tab owns a connect view and, once connected, a server view that loads hidden and replaces the connect view on its first commit.GET /api/sessionsevery 2 s, backs off 60 s on a 429 and stops on 401/403 (no retry loop on a wrong password).WKWebViewasked (macos.rsmaps each web view to its tab).WKWebsiteDataStore(dataStoreForIdentifierwith a stable id hashed from the server URL), so a server on :3000 and a beta on :5000 of the same host cannot log each other out. Before macOS 14 that API does not exist, so a second tab on a host that is already open is refused with a message.policy.rsparses strictly and refuses from any frame other than that exact bundled page. The server never changes; the app is a client of the web UI like a browser tab.Code map: new pure model
src/tabs.rs(names, colours, order, shortcuts, strip/overview state);agents.rsreads per-session detail;config.rsstores tabs;menu.rshas the Server menu and the tab context menu;logo.rswatches all servers;main.rsholds the window and tab flows. Changeset included (patch).Testing
cargo fmt --check, 303 unit tests passed (9 ignored), clippy-D warningsclean, universal DMG builds andcodesign --verifypasses.aarch64-apple-darwinwith--locked, clean.test/desktop-tabs-pages.browser.test.ts(new, 3 walks over the strip and overview pages) andtest/desktop-connect-page.browser.test.ts(new step for a restored tab), 8/8. Added toBROWSER_TEST_GLOBS.Not yet run in a real window (the Mac mini has no screen session). To check on a Mac before merging:
Known limits: toasts from the tab code have no zh-CN text yet; ⌘9 exists only from nine tabs on.