Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(spaces): the notch counts only running or starting Spaces and collapses at zero (#5872)

ddupont3a3178167934
diff --git a/apps/cua-spaces-desktop/src/model/app-model.ts b/apps/cua-spaces-desktop/src/model/app-model.ts
index af77f390b4..dc65975d98 100644
--- a/apps/cua-spaces-desktop/src/model/app-model.ts
+++ b/apps/cua-spaces-desktop/src/model/app-model.ts
@@ -887,7 +887,7 @@ export class AppModel {
/** The count the menu bar item and the notch show. */
get statusLine(): string {
- return this.native.appStatusLine(this.native.appOpenableCount(this.spaces));
+ return this.native.appOnStatusLine(this.native.appOnCount(this.spaces));
}
/** The window chrome (account line, New Space, empty state). */
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts
index 837d9a15f3..f829eb3026 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts
@@ -1092,6 +1092,16 @@ const DEFINITIONS = {
ret: FfiType.RustBuffer,
hasRustCallStatus: true,
},
+ "uniffi_cua_spaces_ffi_fn_func_app_on_count": {
+ args: [FfiType.RustBuffer],
+ ret: FfiType.UInt32,
+ hasRustCallStatus: true,
+ },
+ "uniffi_cua_spaces_ffi_fn_func_app_on_status_line": {
+ args: [FfiType.UInt32],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
"uniffi_cua_spaces_ffi_fn_func_app_onboarding_action_from_json": {
args: [FfiType.RustBuffer],
ret: FfiType.RustBuffer,
@@ -2887,6 +2897,16 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cua_spaces_ffi_checksum_func_app_on_count": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
+ "uniffi_cua_spaces_ffi_checksum_func_app_on_status_line": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cua_spaces_ffi_checksum_func_app_onboarding_action_from_json": {
args: [],
ret: FfiType.UInt16,
@@ -4314,6 +4334,8 @@ interface NativeModuleInterface {
uniffi_cua_spaces_ffi_fn_func_app_notifications_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_notifications_plan(feed: Uint8Array, seenMs: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_notifications_view(feed: Uint8Array, nowMs: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cua_spaces_ffi_fn_func_app_on_count(spaces: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;
+ uniffi_cua_spaces_ffi_fn_func_app_on_status_line(count: number, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_onboarding_action_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_onboarding_copy(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cua_spaces_ffi_fn_func_app_onboarding_initial(installerMode: Uint8Array, identity: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
@@ -4673,6 +4695,8 @@ interface NativeModuleInterface {
uniffi_cua_spaces_ffi_checksum_func_app_notifications_from_json(): number;
uniffi_cua_spaces_ffi_checksum_func_app_notifications_plan(): number;
uniffi_cua_spaces_ffi_checksum_func_app_notifications_view(): number;
+ uniffi_cua_spaces_ffi_checksum_func_app_on_count(): number;
+ uniffi_cua_spaces_ffi_checksum_func_app_on_status_line(): number;
uniffi_cua_spaces_ffi_checksum_func_app_onboarding_action_from_json(): number;
uniffi_cua_spaces_ffi_checksum_func_app_onboarding_copy(): number;
uniffi_cua_spaces_ffi_checksum_func_app_onboarding_initial(): number;
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
index 1a630bedf4..b3c87b6d7c 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
@@ -2965,6 +2965,42 @@ export function appNotificationsView(feed: Array<AppNotificationInput>, nowMs: b
));
}
+/**
+ * The Spaces on or starting (the notch tab and the menu bar item); never
+ * This machine, a stopped Space or a failed one.
+ */
+export function appOnCount(spaces: Array<AppSpace>): number {
+ return FfiConverterUInt32.lift(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_spaces_ffi_fn_func_app_on_count(
+ FfiConverterSequenceTypeAppSpace.lower(spaces, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
+/**
+ * The menu bar item's status line for `count` Spaces on ("No Spaces
+ * running", "3 Spaces running").
+ */
+export function appOnStatusLine(count: number): string {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterString.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cua_spaces_ffi_fn_func_app_on_status_line(
+ FfiConverterUInt32.lower(count, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
/**
* A first-run action from JSON (parity flows).
*/
@@ -3148,7 +3184,7 @@ export function appOnboardingView(state: AppOnboardingState): AppOnboardingView
}
/**
- * The Spaces the user can open (the notch tab and the menu bar item).
+ * The Spaces the user can open (the open notch's tiles), on or not.
*/
export function appOpenableCount(spaces: Array<AppSpace>): number {
return FfiConverterUInt32.lift(uniffiCaller.rustCall(
@@ -29788,7 +29824,7 @@ export type AppNotchView = {
*/
label: string,
/**
- * "N Spaces": the tab's spoken label (remote Spaces only).
+ * "N Spaces": the tab's spoken label (Spaces on or starting only).
*/
countLabel: string,
/**
@@ -29813,7 +29849,8 @@ export type AppNotchView = {
*/
hidden: boolean,
/**
- * The tab shows (closed, no drag in flight; a drag tucks it away).
+ * The tab shows (closed, no drag in flight, at least one Space on or
+ * starting; a drag tucks it away, and with none the notch is bare).
*/
showTab: boolean,
/**
@@ -66126,6 +66163,12 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_notifications_view() !== 27432) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_notifications_view");
}
+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_on_count() !== 27823) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_on_count");
+ }
+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_on_status_line() !== 37662) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_on_status_line");
+ }
if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_onboarding_action_from_json() !== 6687) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_onboarding_action_from_json");
}
@@ -66153,7 +66196,7 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_onboarding_view() !== 63118) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_onboarding_view");
}
- if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_openable_count() !== 46279) {
+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_openable_count() !== 49692) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_openable_count");
}
if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_os_icon_svg() !== 43181) {
diff --git a/apps/cua-spaces-desktop/test/host-bridge.test.ts b/apps/cua-spaces-desktop/test/host-bridge.test.ts
index b879ed1ff7..e679661723 100644
--- a/apps/cua-spaces-desktop/test/host-bridge.test.ts
+++ b/apps/cua-spaces-desktop/test/host-bridge.test.ts
@@ -851,7 +851,8 @@ describe.skipIf(!built)("This machine, Devices and Settings on the app core", ()
expect(real.map((s) => s.id)).toContain("relay:m1/space-1");
expect(model.spaces.some((s) => isMachineDesktop(s))).toBe(true);
const items = menuItems(bridge.context);
- expect(items[0]!.label).toBe(native.appStatusLine(real.length));
+ // The count is the Spaces on or starting among them (never a stopped one).
+ expect(items[0]!.label).toBe(native.appOnStatusLine(native.appOnCount(model.spaces)));
expect(items.map((i) => i.id)).toEqual(expect.arrayContaining(["open", "newSpace", "settings", "quit"]));
});
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
index 20a9899c0c..aff429bfca 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
@@ -1395,9 +1395,9 @@ public final class AppModel {
}
/// The menu bar item's status line.
- /// Counts the Spaces the user can open, the notch's count (never This
- /// machine or another of your machines, even while they provide Spaces).
- public var statusLine: String { appStatusLine(count: appOpenableCount(spaces: spaces)) }
+ /// Counts the Spaces on or starting, the notch's count (never a stopped
+ /// Space, This machine or another of your machines).
+ public var statusLine: String { appOnStatusLine(count: appOnCount(spaces: spaces)) }
/// The menu bar item's menu: the count, Cua Volume's sync state next to
/// it and its conflicts, then the actions.
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/NotchTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/NotchTests.swift
index efd298b8e7..6970df5ad6 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/NotchTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/NotchTests.swift
@@ -467,6 +467,38 @@ struct NotchTests {
#expect(notch.view.phase == .closed)
}
+ // MARK: - The count
+
+ /// The tab counts only the Spaces on or starting: with every Space
+ /// stopped there is no tab at all (no "0"), the stopped Spaces are
+ /// still tiles that take drops, and one starting brings the tab back.
+ @Test func theTabCountsOnlySpacesOnAndGoesAtZero() async throws {
+ let notch = NotchModel(scheduler: ManualScheduler())
+ let roster = await spaces()
+ let stopped = roster.map { s -> AppSpace in
+ var s = s
+ if s.id != "this-mac" { s.status = .suspended }
+ return s
+ }
+ notch.spaces = stopped
+ #expect(appOnCount(spaces: stopped) == 0)
+ #expect(notch.view.phase == .closed && !notch.view.showTab)
+ #expect(appOnStatusLine(count: 0) == "No Spaces running")
+ notch.send(.click)
+ let tiles = notch.view.tiles
+ #expect(!tiles.isEmpty && tiles.allSatisfy { $0.dim })
+ #expect(tiles.contains { $0.dropTarget }, "a reachable stopped Space still takes drops")
+ notch.send(.click)
+
+ var starting = stopped
+ let i = try #require(starting.firstIndex { $0.id != "this-mac" })
+ starting[i].status = .provisioning
+ notch.spaces = starting
+ #expect(notch.view.showTab)
+ #expect(notch.view.tab.count == "1" && notch.view.tab.word == "Space")
+ #expect(notch.view.countLabel == "1 Space")
+ }
+
// MARK: - The notch setting
@Test func hidingTheNotchStopsHoverAndDragsAndShowingRestoresIt() async {
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
index 41b163e9dd..fece942fa7 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
@@ -1338,7 +1338,7 @@ struct ParityTests {
let state: AppHostState? = c["hostState"] is NSNull ? nil : try appHostStateFromJson(json: text(c["hostState"]))
let roster = appWithThisMachine(spaces: spaces, status: state.map { appHostSummaryInput(state: $0) }, nowMs: now)
let tab = appNotchView(state: appNotchInitial(), spaces: roster).tab.count
- let count = appOpenableCount(spaces: roster)
+ let count = appOnCount(spaces: roster)
let sync: AppDriveSyncInput? = c["sync"] is NSNull ? nil : try appDriveSyncFromJson(json: text(c["sync"]))
let menu = appMenu(input: AppMenuInput(spaces: roster, keyvault: nil, sync: sync,
nowMs: UInt64(c["nowMs"] as! Int64),
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift
index 9da5206aec..8abf41a21e 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/SnapshotTests.swift
@@ -557,6 +557,17 @@ struct SnapshotTests {
try await assertNotch("notch-closed") { _ in }
}
+ /// Every Space stopped: nothing on, so no tab beside the notch.
+ @Test func notchClosedNoneOn() async throws {
+ try await assertNotch("notch-closed-none-on") { n in
+ n.spaces = n.spaces.map { s in
+ var s = s
+ if s.id != "this-mac" { s.status = .suspended }
+ return s
+ }
+ }
+ }
+
@Test func notchHover() async throws {
try await assertNotch("notch-hover") { $0.send(.hoverEnter) }
}
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-hotspot.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-hotspot.png
index a472fcffeb..162e3a7ef7 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-hotspot.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-hotspot.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-keyvault.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-keyvault.png
index a472fcffeb..162e3a7ef7 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-keyvault.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-keyvault.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-provisioning.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-provisioning.png
index 4927f7393d..a472fcffeb 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-provisioning.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-provisioning.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-transfer.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-transfer.png
index 339e8ec88a..9cb1e76163 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-transfer.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-activity-transfer.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-closed-none-on.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-closed-none-on.png
new file mode 100644
index 0000000000..65c8b81d7a
Binary files /dev/null and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-closed-none-on.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-closed.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-closed.png
index a472fcffeb..162e3a7ef7 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-closed.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-closed.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-hover.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-hover.png
index c8d0ea91a5..dd15503c48 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-hover.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-hover.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-tab-hover.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-tab-hover.png
index e4d321d662..e68addbd4a 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-tab-hover.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-tab-hover.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-tab-pressed.png b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-tab-pressed.png
index 7271bdfd53..aef1c743e3 100644
Binary files a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-tab-pressed.png and b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/Snapshots/notch-tab-pressed.png differ
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift
index 39677bce39..0c753094e3 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift
@@ -606,10 +606,13 @@ struct ViewModelTests {
@Test func menuBarAndChromeAreTheCores() async {
let model = makeModel()
await model.refresh()
- // The notch's count: This machine counts only while it is shared.
- let open = appOpenableCount(spaces: model.spaces)
- #expect(model.menuBar.map(\.label) == appMenuBar(spaces: open).map(\.label))
- #expect(model.notch.view.tab.count == String(open))
+ // The notch's count: the Spaces on or starting (never This machine,
+ // never a stopped Space); the menu bar item says the same.
+ let on = appOnCount(spaces: model.spaces)
+ #expect(model.menuBar.first?.label == appOnStatusLine(count: on))
+ #expect(model.menuBar.dropFirst().map(\.label) == appMenuBar(spaces: on).dropFirst().map(\.label))
+ #expect(model.statusLine == appOnStatusLine(count: on))
+ #expect(model.notch.view.tab.count == String(on))
#expect(model.chrome.emptyTitle == "No Spaces yet")
#expect(model.chrome.signInLabel == nil, "no account: signing in is not offered")
}
diff --git a/apps/cua-spaces/src-tauri/src/tray.rs b/apps/cua-spaces/src-tauri/src/tray.rs
index ed978891d2..3aaed02f53 100644
--- a/apps/cua-spaces/src-tauri/src/tray.rs
+++ b/apps/cua-spaces/src-tauri/src/tray.rs
@@ -286,7 +286,7 @@ mod tests {
sync: Some(sync),
..Default::default()
});
- assert_eq!(items[0].label, "No Spaces \u{b7} Syncing 3\u{2026}");
+ assert_eq!(items[0].label, "No Spaces running \u{b7} Syncing 3\u{2026}");
assert_eq!(items[1].id, MenuItemId::VolumeConflicts);
assert_eq!(items[1].label, "2 conflicts");
assert!(items[1].enabled);
diff --git a/apps/cua-spaces/src/App.test.tsx b/apps/cua-spaces/src/App.test.tsx
index ed330aea9b..54733a4ffb 100644
--- a/apps/cua-spaces/src/App.test.tsx
+++ b/apps/cua-spaces/src/App.test.tsx
@@ -45,7 +45,7 @@ const tileNames = () =>
describe("ambient -> switcher", () => {
it("starts ambient with dots and count, expands on click and drives the native mode", async () => {
const { bridge, user } = renderApp();
- const ambient = screen.getByRole("button", { name: /3 Spaces, 2 active/ });
+ const ambient = screen.getByRole("button", { name: /2 Spaces, 2 active/ });
expect(ambient).toBeInTheDocument();
await waitFor(() => expect(bridge.modes).toContain("ambient"));
@@ -61,31 +61,31 @@ describe("ambient -> switcher", () => {
it("collapses with Escape", async () => {
const { user } = renderApp();
- await user.click(screen.getByRole("button", { name: /3 Spaces/ }));
+ await user.click(screen.getByRole("button", { name: /2 Spaces/ }));
await user.keyboard("{Escape}");
// Island (the default theme) springs the panel back into the notch before
// collapsing to the ambient tab, so the tab reappears asynchronously.
- expect(await screen.findByRole("button", { name: /3 Spaces/ })).toBeInTheDocument();
+ expect(await screen.findByRole("button", { name: /2 Spaces/ })).toBeInTheDocument();
});
});
describe("menu-bar presentation", () => {
it("shows the ambient 'N Spaces' tab in the default notch mode", () => {
renderApp();
- expect(screen.getByRole("button", { name: /3 Spaces, 2 active/ })).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: /2 Spaces, 2 active/ })).toBeInTheDocument();
});
it("hides the ambient tab when menu-bar mode is stored (status item is the entry)", () => {
window.localStorage.setItem(SETTINGS_KEYS.menuBar, "true");
renderApp();
- expect(screen.queryByRole("button", { name: /3 Spaces, 2 active/ })).toBeNull();
+ expect(screen.queryByRole("button", { name: /2 Spaces, 2 active/ })).toBeNull();
});
});
describe("keyboard selection and MRU", () => {
it("moves focus with arrows, selects with Enter, reorders MRU, confirms, then collapses", async () => {
const { user } = renderApp();
- await user.click(screen.getByRole("button", { name: /3 Spaces/ }));
+ await user.click(screen.getByRole("button", { name: /2 Spaces/ }));
// The filter box is focused on open; arrow keys then drive tile navigation.
expect(screen.getByRole("searchbox")).toHaveFocus();
@@ -101,16 +101,16 @@ describe("keyboard selection and MRU", () => {
expect(tileNames()).toEqual(["Linux Build", "This Mac", "Windows QA", "Research"]);
expect(screen.getAllByRole("status")[0]).toHaveTextContent("Switching to Linux Build");
- await waitFor(() => expect(screen.getByRole("button", { name: /3 Spaces/ })).toBeInTheDocument());
+ await waitFor(() => expect(screen.getByRole("button", { name: /2 Spaces/ })).toBeInTheDocument());
// Re-open: MRU order persists.
- await user.click(screen.getByRole("button", { name: /3 Spaces/ }));
+ await user.click(screen.getByRole("button", { name: /2 Spaces/ }));
// The grid mounts as the notch opens: wait for it, as for the collapse.
await waitFor(() => expect(tileNames()[0]).toBe("Linux Build"));
});
it("wraps from the New tile back to the first Space and reaches New with End", async () => {
const { user } = renderApp();
- await user.click(screen.getByRole("button", { name: /3 Spaces/ }));
+ await user.click(screen.getByRole("button", { name: /2 Spaces/ }));
await user.keyboard("{End}");
expect(screen.getByRole("option", { name: /New Space/ })).toHaveFocus();
await user.keyboard("{ArrowRight}");
@@ -138,17 +138,17 @@ describe("New Space opens a window, never a notch panel", () => {
it("Cmd/Ctrl+N asks the shell for the New Space window and folds the notch away", async () => {
const { spacesList, user } = renderWithList();
- await user.click(screen.getByRole("button", { name: /3 Spaces/ }));
+ await user.click(screen.getByRole("button", { name: /2 Spaces/ }));
await user.keyboard("{Control>}n{/Control}");
expect(spacesList.openNewSpace).toHaveBeenCalledTimes(1);
expect(screen.queryByRole("heading", { name: "New Fleet" })).toBeNull();
expect(screen.queryByRole("dialog", { name: "New Space" })).toBeNull();
- expect(await screen.findByRole("button", { name: /3 Spaces/ })).toBeInTheDocument();
+ expect(await screen.findByRole("button", { name: /2 Spaces/ })).toBeInTheDocument();
});
it("the + New tile does the same", async () => {
const { spacesList, user } = renderWithList();
- await user.click(screen.getByRole("button", { name: /3 Spaces/ }));
+ await user.click(screen.getByRole("button", { name: /2 Spaces/ }));
await user.click(screen.getByRole("option", { name: /New Space/ }));
expect(spacesList.openNewSpace).toHaveBeenCalledTimes(1);
expect(screen.queryByRole("searchbox")).toBeNull();
diff --git a/apps/cua-spaces/src/components/Ambient.test.tsx b/apps/cua-spaces/src/components/Ambient.test.tsx
index c03c5467ac..f63a2a27f9 100644
--- a/apps/cua-spaces/src/components/Ambient.test.tsx
+++ b/apps/cua-spaces/src/components/Ambient.test.tsx
@@ -4,7 +4,7 @@
import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
-import { openableCount } from "../model/window";
+import { onCount } from "../model/window";
import { FIXTURE_SPACES } from "../model/fixtures";
import type { Space } from "../model/types";
import { Ambient } from "./Ambient";
@@ -38,13 +38,15 @@ describe("Ambient (notched) teleport morph", () => {
describe("Ambient tab and activity (the core's notch module)", () => {
const remote = FIXTURE_SPACES.filter((s) => s.status !== "local");
+ const on = remote.filter((s) => s.status !== "suspended");
it("is two rows: the count over the word", () => {
const { container } = render(<Ambient spaces={FIXTURE_SPACES} displayStyle="notched" onExpand={vi.fn()} />);
- // The Spaces the user can open (the core's count, the menu bar item's too):
- // the fixture's This Mac provides Spaces, but a machine is not a Space.
- const n = openableCount(FIXTURE_SPACES);
- expect(n).toBe(remote.length);
+ // The Spaces on or starting (the core's count, the menu bar item's too):
+ // the fixture's This Mac provides Spaces, but a machine is not a Space,
+ // and its stopped Space is not counted.
+ const n = onCount(FIXTURE_SPACES);
+ expect(n).toBe(on.length);
expect(container.querySelector(".ambient-tab-count")).toHaveTextContent(String(n));
expect(container.querySelector(".ambient-tab-word")).toHaveTextContent(n === 1 ? "Space" : "Spaces");
});
diff --git a/apps/cua-spaces/src/model/parity.test.ts b/apps/cua-spaces/src/model/parity.test.ts
index 7f1f37018a..343bda1ad7 100644
--- a/apps/cua-spaces/src/model/parity.test.ts
+++ b/apps/cua-spaces/src/model/parity.test.ts
@@ -55,6 +55,7 @@ import {
deleteFailedText,
detailCopy,
mainChrome,
+ onCount,
openableCount,
pipClick,
pipReduce,
@@ -155,6 +156,7 @@ const MODEL: Record<string, (a: Args) => unknown> = {
'window.chrome': (a) => mainChrome(a.input),
'window.menu': (a) => trayMenu(a.input),
'spaces.openableCount': (a) => openableCount(a.spaces),
+ 'spaces.onCount': (a) => onCount(a.spaces),
'settings.page': (a) => settingsPage(a.input),
'loginItem.launchPlan': (a) => launchPlan(a.choice, a.onboarded, a.serves, a.status),
'host.formInitial': () => hostFormInitial(),
diff --git a/apps/cua-spaces/src/model/window.ts b/apps/cua-spaces/src/model/window.ts
index 93110b7198..31b2f04f20 100644
--- a/apps/cua-spaces/src/model/window.ts
+++ b/apps/cua-spaces/src/model/window.ts
@@ -389,3 +389,9 @@ export function trayMenu(input: MenuInput): MenuItem[] {
export function openableCount(spaces: readonly Space[]): number {
return core("spaces.openableCount", { spaces });
}
+
+/** The Spaces on or starting (the notch tab's and the menu bar item's
+ * count): never a stopped Space or This machine. */
+export function onCount(spaces: readonly Space[]): number {
+ return core("spaces.onCount", { spaces });
+}
diff --git a/apps/cua-spaces/src/state/trayMenu.test.tsx b/apps/cua-spaces/src/state/trayMenu.test.tsx
index b81db96cd4..3f6679f317 100644
--- a/apps/cua-spaces/src/state/trayMenu.test.tsx
+++ b/apps/cua-spaces/src/state/trayMenu.test.tsx
@@ -7,7 +7,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
import { FIXTURE_NOW, FIXTURE_SPACES } from "../model/fixtures";
import { withThisMachine } from "../model/host";
import { notchTab } from "../model/notch";
-import { openableCount, trayMenu, type MenuItem } from "../model/window";
+import { onCount, trayMenu, type MenuItem } from "../model/window";
import { TRAY_SYNC_POLL_MS, useTrayMenu } from "./trayMenu";
// Cua Volume's sync line shows with its experiment on (Settings,
@@ -66,12 +66,14 @@ describe("the menu bar item's menu", () => {
await waitFor(() => expect(calls).toEqual(["volume_sync_status", "volume_storage"]));
const items = menus.at(-1)!;
expect(items).toEqual(trayMenu({ spaces: ROSTER, keyvault: null, sync: null, backend: "s3", nowMs: FIXTURE_NOW }));
- // "This machine" (not shared) is in the roster but not in the count.
+ // "This machine" (not shared) is in the roster but not in the count,
+ // and neither is a stopped Space: only the ones on or starting.
expect(ROSTER.some((s) => s.id === "this-mac")).toBe(true);
- const n = openableCount(ROSTER);
- expect(n).toBe(ROSTER.length - 1);
+ expect(ROSTER.some((s) => s.status === "suspended")).toBe(true);
+ const n = onCount(ROSTER);
+ expect(n).toBe(ROSTER.filter((s) => s.id !== "this-mac" && s.status !== "suspended").length);
expect(String(notchTab(ROSTER).count)).toBe(String(n));
- expect(items[0]).toMatchObject({ id: "status", label: `${n} Spaces`, enabled: false });
+ expect(items[0]).toMatchObject({ id: "status", label: `${n} Spaces running`, enabled: false });
expect(items.map((i) => i.id)).not.toContain("volume-conflicts");
});
@@ -82,7 +84,7 @@ describe("the menu bar item's menu", () => {
const { menus } = run(() => sync({ pending_uploads: 3, conflicts: [conflict] }));
await tick(0);
const items = menus.at(-1)!;
- expect(items[0]!.label).toBe(`${openableCount(ROSTER)} Spaces`);
+ expect(items[0]!.label).toBe(`${onCount(ROSTER)} Spaces running`);
expect(items.map((i) => i.id)).not.toContain("volume-conflicts");
} finally {
vi.useRealTimers();
@@ -95,25 +97,25 @@ describe("the menu bar item's menu", () => {
try {
const { menus, setMenu } = run(() => answer);
await tick(0);
- const n = openableCount(ROSTER);
+ const n = onCount(ROSTER);
let items = menus.at(-1)!;
- expect(items[0]!.label).toBe(`${n} Spaces · Syncing 3…`);
+ expect(items[0]!.label).toBe(`${n} Spaces running · Syncing 3…`);
expect(items[1]).toEqual({ id: "volume-conflicts", label: "2 conflicts", shortcut: null, enabled: true });
answer = sync();
await tick(TRAY_SYNC_POLL_MS);
items = menus.at(-1)!;
- expect(items[0]!.label).toBe(`${n} Spaces · Synced`);
+ expect(items[0]!.label).toBe(`${n} Spaces running · Synced`);
expect(items.map((i) => i.id)).not.toContain("volume-conflicts");
answer = sync({ feed: "error" });
await tick(TRAY_SYNC_POLL_MS);
- expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces · Offline`);
+ expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces running · Offline`);
// This machine's store, one device: no sync word.
answer = sync({ feed: "off", conflicts: [conflict] });
await tick(TRAY_SYNC_POLL_MS);
- expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces`);
+ expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces running`);
expect(menus.at(-1)!.map((i) => i.id)).not.toContain("volume-conflicts");
// Unchanged reads send nothing.
@@ -131,12 +133,12 @@ describe("the menu bar item's menu", () => {
try {
const { menus } = run(() => sync(), () => clock);
await tick(0);
- const n = openableCount(ROSTER);
- expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces \u00b7 Synced`);
+ const n = onCount(ROSTER);
+ expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces running \u00b7 Synced`);
// The same answer (last poll unchanged), 31 s later.
clock = FIXTURE_NOW + 31_000;
await tick(TRAY_SYNC_POLL_MS);
- expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces \u00b7 Offline`);
+ expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces running \u00b7 Offline`);
expect(menus.at(-1)).toEqual(
trayMenu({ spaces: ROSTER, keyvault: null, sync: sync() as never, backend: "s3", nowMs: clock }),
);
@@ -157,13 +159,13 @@ describe("the menu bar item's menu", () => {
try {
const { menus, calls } = run(one, () => FIXTURE_NOW, () => storage);
await tick(0);
- const n = openableCount(ROSTER);
+ const n = onCount(ROSTER);
// The engine says "live" even here; the core leaves it out.
- expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces`);
+ expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces running`);
expect(menus.at(-1)!.map((i) => i.id)).not.toContain("volume-conflicts");
storage = S3;
await tick(TRAY_SYNC_POLL_MS);
- expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces \u00b7 Syncing 2\u2026`);
+ expect(menus.at(-1)![0]!.label).toBe(`${n} Spaces running \u00b7 Syncing 2\u2026`);
expect(menus.at(-1)!.map((i) => i.id)).toContain("volume-conflicts");
// Both are read on every tick.
expect(calls.filter((c) => c === "volume_storage")).toHaveLength(2);
@@ -178,7 +180,7 @@ describe("the menu bar item's menu", () => {
await waitFor(() => expect(calls.length).toBe(2));
const fewer = ROSTER.filter((s) => s.id !== "this-mac" && s.status !== "local").slice(0, 1);
hook.rerender({ spaces: fewer });
- await waitFor(() => expect(menus.at(-1)![0]!.label).toBe("1 Space"));
+ await waitFor(() => expect(menus.at(-1)![0]!.label).toBe("1 Space running"));
expect(menus.at(-1)).toEqual(trayMenu({ spaces: fewer, keyvault: null, sync: null, backend: "s3", nowMs: FIXTURE_NOW }));
});
});
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json
index 9341e75244..8471e2addb 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json
@@ -10,7 +10,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces (disabled)",
+ "status: No Spaces running (disabled)",
"---",
"open: Open Cua Spaces",
"new-space: New Space…",
@@ -124,7 +124,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces · Syncing 2… (disabled)",
+ "status: No Spaces running · Syncing 2… (disabled)",
"volume-conflicts: 1 conflict",
"---",
"open: Open Cua Spaces",
@@ -259,7 +259,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces · Syncing 2… (disabled)",
+ "status: No Spaces running · Syncing 2… (disabled)",
"volume-conflicts: 1 conflict",
"---",
"open: Open Cua Spaces",
@@ -390,7 +390,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces · Syncing 2… (disabled)",
+ "status: No Spaces running · Syncing 2… (disabled)",
"volume-conflicts: 1 conflict",
"---",
"open: Open Cua Spaces",
@@ -508,7 +508,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces · Syncing 2… (disabled)",
+ "status: No Spaces running · Syncing 2… (disabled)",
"volume-conflicts: 1 conflict",
"---",
"open: Open Cua Spaces",
@@ -626,7 +626,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces · Syncing 2… (disabled)",
+ "status: No Spaces running · Syncing 2… (disabled)",
"volume-conflicts: 1 conflict",
"---",
"open: Open Cua Spaces",
@@ -744,7 +744,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces (disabled)",
+ "status: No Spaces running (disabled)",
"---",
"open: Open Cua Spaces",
"new-space: New Space…",
@@ -867,7 +867,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces (disabled)",
+ "status: No Spaces running (disabled)",
"---",
"open: Open Cua Spaces",
"new-space: New Space…",
@@ -993,7 +993,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces (disabled)",
+ "status: No Spaces running (disabled)",
"---",
"open: Open Cua Spaces",
"new-space: New Space…",
@@ -1118,7 +1118,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces (disabled)",
+ "status: No Spaces running (disabled)",
"---",
"open: Open Cua Spaces",
"new-space: New Space…",
@@ -1244,7 +1244,7 @@
"open: Open [-] ?Open the desktop in its own window (primary)"
],
"menu": [
- "status: No Spaces (disabled)",
+ "status: No Spaces running (disabled)",
"---",
"open: Open Cua Spaces",
"new-space: New Space…",
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/menu-count.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/menu-count.json
index d7a2f4f569..4c70caef30 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/menu-count.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/menu-count.json
@@ -6,7 +6,7 @@
"case": "this machine not hosting",
"count": 0,
"menu": [
- "status: No Spaces (disabled)",
+ "status: No Spaces running (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
@@ -19,7 +19,7 @@
"case": "this machine hosting",
"count": 0,
"menu": [
- "status: No Spaces (disabled)",
+ "status: No Spaces running (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
@@ -32,7 +32,7 @@
"case": "hosting stopped",
"count": 1,
"menu": [
- "status: 1 Space (disabled)",
+ "status: 1 Space running (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
@@ -45,7 +45,7 @@
"case": "provider only",
"count": 1,
"menu": [
- "status: 1 Space (disabled)",
+ "status: 1 Space running (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
@@ -58,7 +58,7 @@
"case": "remote spaces",
"count": 3,
"menu": [
- "status: 3 Spaces (disabled)",
+ "status: 3 Spaces running (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
@@ -71,7 +71,7 @@
"case": "remote spaces and hosting",
"count": 2,
"menu": [
- "status: 2 Spaces (disabled)",
+ "status: 2 Spaces running (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
@@ -79,12 +79,38 @@
],
"notch": "2"
},
+ {
+ "agree": true,
+ "case": "four spaces stopped",
+ "count": 0,
+ "menu": [
+ "status: No Spaces running (disabled)",
+ "open: Open Cua Spaces",
+ "new-space: New Space…",
+ "settings: Settings…",
+ "quit: Quit Cua Spaces"
+ ],
+ "notch": "0"
+ },
+ {
+ "agree": true,
+ "case": "one of four spaces running",
+ "count": 1,
+ "menu": [
+ "status: 1 Space running (disabled)",
+ "open: Open Cua Spaces",
+ "new-space: New Space…",
+ "settings: Settings…",
+ "quit: Quit Cua Spaces"
+ ],
+ "notch": "1"
+ },
{
"agree": true,
"case": "volume on this mac, one device",
"count": 1,
"menu": [
- "status: 1 Space (disabled)",
+ "status: 1 Space running (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
@@ -97,7 +123,7 @@
"case": "volume synced",
"count": 1,
"menu": [
- "status: 1 Space · Synced (disabled)",
+ "status: 1 Space running · Synced (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
@@ -110,7 +136,7 @@
"case": "volume syncing",
"count": 1,
"menu": [
- "status: 1 Space · Syncing 3… (disabled)",
+ "status: 1 Space running · Syncing 3… (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
@@ -123,7 +149,7 @@
"case": "volume conflicts",
"count": 1,
"menu": [
- "status: 1 Space · Synced (disabled)",
+ "status: 1 Space running · Synced (disabled)",
"volume-conflicts: 2 conflicts",
"open: Open Cua Spaces",
"new-space: New Space…",
@@ -137,7 +163,7 @@
"case": "volume offline",
"count": 1,
"menu": [
- "status: 1 Space · Offline (disabled)",
+ "status: 1 Space running · Offline (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
@@ -150,7 +176,7 @@
"case": "volume unreachable",
"count": 1,
"menu": [
- "status: 1 Space · Offline (disabled)",
+ "status: 1 Space running · Offline (disabled)",
"open: Open Cua Spaces",
"new-space: New Space…",
"settings: Settings…",
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/notch.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/notch.json
index 37425c953b..d7e89d3c88 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/notch.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/notch.json
@@ -210,7 +210,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -426,7 +426,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -507,7 +507,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -564,7 +564,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -717,7 +717,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -739,7 +739,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -940,7 +940,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -962,7 +962,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -984,7 +984,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -1006,7 +1006,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -1028,7 +1028,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
@@ -1109,7 +1109,7 @@
"phase": "closed",
"prompt": null,
"tab": [
- "4",
+ "3",
"Spaces"
],
"tiles": []
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/teleport-review.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/teleport-review.json
index 13a27128d1..46538947e7 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/teleport-review.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/teleport-review.json
@@ -570,8 +570,8 @@
"phase": "closed",
"prompt": null,
"tab": [
- "2",
- "Spaces"
+ "1",
+ "Space"
],
"tiles": []
},
@@ -653,8 +653,8 @@
"phase": "closed",
"prompt": null,
"tab": [
- "2",
- "Spaces"
+ "1",
+ "Space"
],
"tiles": []
},
@@ -761,8 +761,8 @@
"phase": "closed",
"prompt": null,
"tab": [
- "2",
- "Spaces"
+ "1",
+ "Space"
],
"tiles": []
},
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/menu-count.json b/libs/cua/crates/cua-spaces-app-core/parity/menu-count.json
index e84142d93d..52bd40dc3c 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/menu-count.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/menu-count.json
@@ -1,6 +1,6 @@
{
"name": "menu-count",
- "about": "The menu bar item and the notch tab count the same Spaces (never This machine or another machine's own desktop, even while it provides Spaces; the Spaces a machine provides count), and the menu shows Cua Volume's sync state next to the count when sync applies: synced, syncing, conflicts (they open the Volume page) and offline; nothing on this Mac's store with one device; a bucket that has not answered for 30 s is offline.",
+ "about": "The menu bar item and the notch tab count the same Spaces, the ones on or starting (a stopped Space is not counted; never This machine or another machine's own desktop, even while it provides Spaces; the Spaces a machine provides count), and the menu shows Cua Volume's sync state next to the count when sync applies: synced, syncing, conflicts (they open the Volume page) and offline; nothing on this Mac's store with one device; a bucket that has not answered for 30 s is offline.",
"now": 1800000000000,
"cases": [
{
@@ -309,6 +309,224 @@
"nowMs": 1800000000000,
"backend": null
},
+ {
+ "name": "four spaces stopped",
+ "hostState": {
+ "configured": true,
+ "mode": "relay",
+ "relayUrl": "https://relay.cua.ai",
+ "name": "Studio",
+ "sharing": true,
+ "serviceInstalled": true,
+ "serviceRunning": true,
+ "serviceKind": "launchd",
+ "online": true,
+ "clients": [
+ {
+ "id": "u1",
+ "email": "[email protected]",
+ "name": "Ada",
+ "streams": 2
+ },
+ {
+ "id": "u2",
+ "email": "[email protected]"
+ }
+ ],
+ "permissions": [
+ {
+ "id": "screen-recording",
+ "title": "Screen Recording",
+ "settingsUrl": "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture",
+ "instructions": "Turn on Cua Spaces"
+ },
+ {
+ "id": "accessibility",
+ "title": "Accessibility",
+ "settingsUrl": "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility",
+ "granted": true
+ }
+ ]
+ },
+ "rows": [
+ {
+ "id": "local:alpha",
+ "name": "alpha",
+ "provider": "local",
+ "spacesdVersion": "0.4.0",
+ "features": [
+ "desktop_stream",
+ "window_stream"
+ ],
+ "addedAt": "2026-09-25T08:00:00Z",
+ "os": "linux",
+ "reachable": false,
+ "error": null,
+ "power": "stop",
+ "powerState": "stopped"
+ },
+ {
+ "id": "local:bravo",
+ "name": "bravo",
+ "provider": "local",
+ "spacesdVersion": "0.4.0",
+ "features": [
+ "desktop_stream",
+ "window_stream"
+ ],
+ "addedAt": "2026-09-25T08:00:00Z",
+ "os": "linux",
+ "reachable": false,
+ "error": null,
+ "power": "stop",
+ "powerState": "stopped"
+ },
+ {
+ "id": "local:charlie",
+ "name": "charlie",
+ "provider": "local",
+ "spacesdVersion": "0.4.0",
+ "features": [
+ "desktop_stream",
+ "window_stream"
+ ],
+ "addedAt": "2026-09-25T08:00:00Z",
+ "os": "linux",
+ "reachable": false,
+ "error": null,
+ "power": "stop",
+ "powerState": "stopped"
+ },
+ {
+ "id": "local:delta",
+ "name": "delta",
+ "provider": "local",
+ "spacesdVersion": "0.4.0",
+ "features": [
+ "desktop_stream",
+ "window_stream"
+ ],
+ "addedAt": "2026-09-25T08:00:00Z",
+ "os": "linux",
+ "reachable": false,
+ "error": null,
+ "power": "stop",
+ "powerState": "stopped"
+ }
+ ],
+ "sync": null,
+ "nowMs": 1800000000000,
+ "backend": null
+ },
+ {
+ "name": "one of four spaces running",
+ "hostState": {
+ "configured": true,
+ "mode": "relay",
+ "relayUrl": "https://relay.cua.ai",
+ "name": "Studio",
+ "sharing": true,
+ "serviceInstalled": true,
+ "serviceRunning": true,
+ "serviceKind": "launchd",
+ "online": true,
+ "clients": [
+ {
+ "id": "u1",
+ "email": "[email protected]",
+ "name": "Ada",
+ "streams": 2
+ },
+ {
+ "id": "u2",
+ "email": "[email protected]"
+ }
+ ],
+ "permissions": [
+ {
+ "id": "screen-recording",
+ "title": "Screen Recording",
+ "settingsUrl": "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture",
+ "instructions": "Turn on Cua Spaces"
+ },
+ {
+ "id": "accessibility",
+ "title": "Accessibility",
+ "settingsUrl": "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility",
+ "granted": true
+ }
+ ]
+ },
+ "rows": [
+ {
+ "id": "local:alpha",
+ "name": "alpha",
+ "provider": "local",
+ "spacesdVersion": "0.4.0",
+ "features": [
+ "desktop_stream",
+ "window_stream"
+ ],
+ "addedAt": "2026-09-25T08:00:00Z",
+ "os": "linux",
+ "reachable": false,
+ "error": null,
+ "power": "stop",
+ "powerState": "stopped"
+ },
+ {
+ "id": "local:bravo",
+ "name": "bravo",
+ "provider": "local",
+ "spacesdVersion": "0.4.0",
+ "features": [
+ "desktop_stream",
+ "window_stream"
+ ],
+ "addedAt": "2026-09-25T08:00:00Z",
+ "os": "linux",
+ "reachable": true,
+ "error": null,
+ "power": "stop",
+ "powerState": "running"
+ },
+ {
+ "id": "local:charlie",
+ "name": "charlie",
+ "provider": "local",
+ "spacesdVersion": "0.4.0",
+ "features": [
+ "desktop_stream",
+ "window_stream"
+ ],
+ "addedAt": "2026-09-25T08:00:00Z",
+ "os": "linux",
+ "reachable": false,
+ "error": null,
+ "power": "stop",
+ "powerState": "stopped"
+ },
+ {
+ "id": "local:delta",
+ "name": "delta",
+ "provider": "local",
+ "spacesdVersion": "0.4.0",
+ "features": [
+ "desktop_stream",
+ "window_stream"
+ ],
+ "addedAt": "2026-09-25T08:00:00Z",
+ "os": "linux",
+ "reachable": false,
+ "error": null,
+ "power": "stop",
+ "powerState": "stopped"
+ }
+ ],
+ "sync": null,
+ "nowMs": 1800000000000,
+ "backend": null
+ },
{
"name": "volume on this mac, one device",
"hostState": {
diff --git a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
index db650e75ae..f424a153d2 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs
@@ -67,6 +67,8 @@ pub const METHODS: &[&str] = &[
"window.menuBar",
"window.menu",
"spaces.openableCount",
+ "spaces.onCount",
+ "spaces.onStatusLine",
"wizard.initial",
"wizard.reduce",
"wizard.view",
@@ -479,6 +481,8 @@ pub fn call_value(method: &str, args: Value) -> Result<Value, CoreError> {
)),
"window.menu" => out(window::menu(&a.get::<window::MenuInput>("input")?)),
"spaces.openableCount" => out(spaces::openable_count(&a.get::<Vec<Space>>("spaces")?)),
+ "spaces.onCount" => out(spaces::on_count(&a.get::<Vec<Space>>("spaces")?)),
+ "spaces.onStatusLine" => out(spaces::on_status_line(a.get("count")?)),
"window.menuBar" => out(window::menu_bar_with_keyvault(
a.get("spaces")?,
a.get::<Option<String>>("keyvault")?.as_deref(),
diff --git a/libs/cua/crates/cua-spaces-app-core/src/notch/mod.rs b/libs/cua/crates/cua-spaces-app-core/src/notch/mod.rs
index cd2a9da539..eab92f932d 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/notch/mod.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/notch/mod.rs
@@ -11,7 +11,8 @@
//! so every shell expands and collapses at the same moments;
//! - [`tiles`]: which Spaces the panel shows, filtered by the header's
//! search ([`matches`]), each with its OS icon ([`os_icon`]);
-//! - [`tab`]: the "N Spaces" tab (count over word);
+//! - [`tab`]: the "N Spaces" tab (count over word): the Spaces that are on
+//! or starting; with none, the closed notch shows no tab at all;
//! - [`activity`]: the indicator left of the closed notch (a transfer, the
//! network hotspot, a Space starting), in that priority.
//!
@@ -492,8 +493,9 @@ pub fn filter(spaces: &[Space], query: &str) -> Vec<Space> {
/// The Space tiles: the Spaces the user can open
/// ([`crate::spaces::openable_spaces`], never This machine or another
-/// machine that only provides Spaces, the same Spaces the tab counts), in
-/// MRU order, at most [`MAX_TILES`].
+/// machine that only provides Spaces), in MRU order, at most
+/// [`MAX_TILES`]. Stopped Spaces are tiles too (dimmed, and they take
+/// drops), but the tab counts only the ones that are on.
pub fn tiles(spaces: &[Space], targeted: Option<&str>) -> Vec<NotchTile> {
tiles_matching(spaces, targeted, "")
}
@@ -847,7 +849,7 @@ pub struct NotchView {
pub prompt: Option<String>,
/// Accessibility label of the panel.
pub label: String,
- /// "N Spaces": the tab's spoken label (remote Spaces only).
+ /// "N Spaces": the tab's spoken label (Spaces on or starting only).
pub count_label: String,
/// The tab's two rows: the count over the word.
pub tab: NotchTab,
@@ -860,7 +862,8 @@ pub struct NotchView {
pub activity: Option<NotchActivity>,
/// The notch is hidden (menu bar only): draw nothing.
pub hidden: bool,
- /// The tab shows (closed, no drag in flight; a drag tucks it away).
+ /// The tab shows (closed, no drag in flight, at least one Space on or
+ /// starting; a drag tucks it away, and with none the notch is bare).
pub show_tab: bool,
/// The pointer rests on the closed notch while the dwell runs: the
/// shells grow it by [`NotchMotion::hover_scale`].
@@ -909,17 +912,18 @@ pub struct NotchTab {
pub word: String,
}
-/// The tab for `spaces`: remote Spaces only (not this machine).
+/// The tab for `spaces`: the Spaces on or starting
+/// ([`crate::spaces::on_count`]), never this machine or a stopped Space.
pub fn tab(spaces: &[Space]) -> NotchTab {
- let n = remote_count(spaces);
+ let n = on_count(spaces);
NotchTab {
count: n.to_string(),
word: if n == 1 { "Space" } else { "Spaces" }.into(),
}
}
-fn remote_count(spaces: &[Space]) -> usize {
- crate::spaces::openable_count(spaces) as usize
+fn on_count(spaces: &[Space]) -> usize {
+ crate::spaces::on_count(spaces) as usize
}
/// A button in the open panel's header.
@@ -1216,7 +1220,7 @@ pub fn view(state: &NotchState, spaces: &[Space]) -> NotchView {
t.signed_in = state.signed_in.contains(&t.id);
}
let n = visible.len();
- let remote = remote_count(spaces);
+ let on = on_count(spaces);
let searching = !query.is_empty();
let header = (phase == NotchPhase::Tiles && !drop_mode)
.then(|| header(&state.query, searching.then_some(n as u32)));
@@ -1249,13 +1253,13 @@ pub fn view(state: &NotchState, spaces: &[Space]) -> NotchView {
(false, false, None)
} else {
(
- phase == NotchPhase::Closed && state.drag.phase == DragOverlayPhase::Idle,
+ phase == NotchPhase::Closed && state.drag.phase == DragOverlayPhase::Idle && on > 0,
phase == NotchPhase::Closed && state.hovering,
activity,
)
};
NotchView {
- count_label: format!("{remote} {}", if remote == 1 { "Space" } else { "Spaces" }),
+ count_label: format!("{on} {}", if on == 1 { "Space" } else { "Spaces" }),
tab: tab(spaces),
hidden: state.hidden,
header,
@@ -1598,6 +1602,103 @@ mod tests {
}
}
+ /// The tab counts only the Spaces on or starting: four stopped Spaces
+ /// are no tab at all (no "0", no empty pill), one starting brings it
+ /// back. Stopped Spaces stay tiles in the open panel, and drop targets.
+ #[test]
+ fn the_tab_counts_only_spaces_on_or_starting_and_goes_at_zero() {
+ use crate::model::{PowerControl, SpacePower, SpaceProgress};
+ let stopped = |id: &str| {
+ let mut s = space(id, id, SpaceOs::Linux, SpaceStatus::Suspended);
+ s.provider = Some(crate::model::SpaceProvider::Local);
+ s.power = Some(SpacePower {
+ control: PowerControl::Stop,
+ off: true,
+ turning_on: None,
+ error: None,
+ stop_reason: None,
+ });
+ s
+ };
+ let this_mac = crate::host::this_machine_space(
+ Some(&crate::host::HostSummaryInput {
+ configured: true,
+ service_running: true,
+ sharing: true,
+ ..Default::default()
+ }),
+ 0,
+ SpaceOs::Macos,
+ );
+ assert_eq!(this_mac.status, SpaceStatus::Local);
+ let mut spaces = vec![
+ this_mac,
+ stopped("a"),
+ stopped("b"),
+ stopped("c"),
+ stopped("d"),
+ ];
+ let closed = NotchState::default();
+
+ // All four stopped, This Mac sharing: nothing to count, no tab.
+ let v = view(&closed, &spaces);
+ assert_eq!(crate::spaces::on_count(&spaces), 0);
+ assert_eq!(v.tab.count, "0");
+ assert_eq!(v.count_label, "0 Spaces");
+ assert!(!v.show_tab, "collapsed at zero");
+ assert_eq!(v.phase, NotchPhase::Closed);
+ // Hovering still opens it on the stopped Spaces, which take drops.
+ let open = view(&reduce(&closed, &NotchEvent::Click).state, &spaces);
+ assert_eq!(open.tiles.len(), 4);
+ assert!(open.tiles.iter().all(|t| t.dim && t.drop_target));
+
+ // One turned on: it is starting, so the tab comes back with 1.
+ spaces[2].power.as_mut().unwrap().turning_on = Some(true);
+ let v = view(&closed, &spaces);
+ assert!(v.show_tab);
+ assert_eq!((v.tab.count.as_str(), v.tab.word.as_str()), ("1", "Space"));
+ // Up and running: still 1.
+ spaces[2].status = SpaceStatus::Running;
+ spaces[2].power.as_mut().unwrap().turning_on = None;
+ spaces[2].power.as_mut().unwrap().off = false;
+ assert_eq!(view(&closed, &spaces).tab.count, "1");
+
+ // Mixed states: running, waiting for approval and being created
+ // count; stopped, failed and deleting do not.
+ let mut approval = space("e", "e", SpaceOs::Linux, SpaceStatus::Approval);
+ approval.provider = Some(crate::model::SpaceProvider::Local);
+ let creating = space("f", "f", SpaceOs::Linux, SpaceStatus::Provisioning);
+ let mut failed = space("g", "g", SpaceOs::Linux, SpaceStatus::Provisioning);
+ failed.progress = Some(SpaceProgress {
+ phase: "pulling".into(),
+ permille: 300,
+ label: "Failed".into(),
+ error: Some("pull failed".into()),
+ credit_url: None,
+ transfer: None,
+ cancellable: false,
+ cancelling: false,
+ retrying: false,
+ fix: None,
+ });
+ let deleting = space("h", "h", SpaceOs::Linux, SpaceStatus::Deleting);
+ spaces.extend([approval, creating, failed, deleting]);
+ let v = view(&closed, &spaces);
+ assert_eq!(v.tab.count, "3");
+ assert_eq!(v.count_label, "3 Spaces");
+ assert!(v.show_tab);
+
+ // Everything stops again: collapsed.
+ let all_stopped: Vec<Space> = spaces
+ .iter()
+ .filter(|s| !matches!(s.id.as_str(), "b" | "e" | "f"))
+ .cloned()
+ .collect();
+ let v = view(&closed, &all_stopped);
+ assert_eq!(v.tab.count, "0");
+ assert!(!v.show_tab);
+ }
+
#[test]
fn the_tab_is_the_count_over_the_word() {
let mut spaces = vec![crate::host::this_machine_space(None, 0, SpaceOs::Macos)];
diff --git a/libs/cua/crates/cua-spaces-app-core/src/parity.rs b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
index d1b94dec5d..6d72139c28 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/parity.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
@@ -4037,7 +4037,8 @@ fn run_drive_storage(f: &Value, h: &dyn Host) -> Result<Value, String> {
Ok(json!({ "flow": "drive-storage", "frames": frames }))
}
-/// The menu bar item and the notch count the same Spaces: for each case
+/// The menu bar item and the notch count the same Spaces, the ones on or
+/// starting: for each case
/// (this machine not hosting, hosting, a provider's Spaces, remote Spaces,
/// then Cua Volume's sync states), the notch tab's count, the menu's lines
/// and whether the two agree.
@@ -4067,7 +4068,7 @@ fn run_menu_count(f: &Value, h: &dyn Host) -> Result<Value, String> {
"notch.view",
json!({ "state": notch_state, "spaces": roster }),
)?;
- let count = c(h, "spaces.openableCount", json!({ "spaces": roster }))?;
+ let count = c(h, "spaces.onCount", json!({ "spaces": roster }))?;
let menu = c(
h,
"window.menu",
diff --git a/libs/cua/crates/cua-spaces-app-core/src/spaces/mod.rs b/libs/cua/crates/cua-spaces-app-core/src/spaces/mod.rs
index 3c3317e294..546362ef95 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/spaces/mod.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/spaces/mod.rs
@@ -419,9 +419,8 @@ pub fn is_machine_desktop(space: &Space) -> bool {
/// The Spaces the user can open, in `spaces`' order: every Space but the
/// machines' own desktops ([`is_machine_desktop`]): not This machine, even
/// while it provides Spaces, and not one of your machines on the relay. A
-/// Space a machine provides is listed. The notch's tiles list these, and
-/// its tab and the menu bar item count them ([`openable_count`]), so the
-/// list and the count always agree.
+/// Space a machine provides is listed. The notch's tiles list these; its
+/// tab and the menu bar item count the ones that are on ([`on_count`]).
pub fn openable_spaces(spaces: &[Space]) -> Vec<Space> {
spaces
.iter()
@@ -430,12 +429,48 @@ pub fn openable_spaces(spaces: &[Space]) -> Vec<Space> {
.collect()
}
-/// How many [`openable_spaces`] there are: the notch tab's and the menu bar
-/// item's number.
+/// How many [`openable_spaces`] there are (the open notch's tiles), on or
+/// not; the tab counts only the ones that are on ([`on_count`]).
pub fn openable_count(spaces: &[Space]) -> u32 {
openable_spaces(spaces).len() as u32
}
+/// Whether `space` is on or on its way up: running (an agent waiting for
+/// approval included), being created or started, or being turned on. A
+/// stopped or suspended Space, one whose create failed and one being
+/// deleted are not.
+pub fn is_on(space: &Space) -> bool {
+ if space.progress.as_ref().is_some_and(|p| p.error.is_some()) {
+ return false;
+ }
+ let turning_on = space
+ .power
+ .as_ref()
+ .is_some_and(|p| p.turning_on == Some(true));
+ match space.status {
+ SpaceStatus::Running | SpaceStatus::Approval | SpaceStatus::Provisioning => true,
+ SpaceStatus::Suspended => turning_on,
+ SpaceStatus::Local | SpaceStatus::Deleting => false,
+ }
+}
+
+/// How many [`openable_spaces`] are on or starting ([`is_on`]): the notch
+/// tab's and the menu bar item's number. Stopped Spaces still show as
+/// tiles in the open notch (they take drops), but they are not counted.
+pub fn on_count(spaces: &[Space]) -> u32 {
+ openable_spaces(spaces).iter().filter(|s| is_on(s)).count() as u32
+}
+
+/// The menu bar item's status line for [`on_count`] Spaces ("No Spaces
+/// running", "1 Space running", "3 Spaces running").
+pub fn on_status_line(on: u32) -> String {
+ match on {
+ 0 => "No Spaces running".into(),
+ 1 => "1 Space running".into(),
+ n => format!("{n} Spaces running"),
+ }
+}
+
/// The three ambient status dots.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
@@ -725,4 +760,49 @@ mod tests {
assert!(is_machine_desktop(&idle));
assert_eq!(openable_count(&[idle]), 0);
}
+
+ /// The notch and the menu bar count the Spaces on or starting, never a
+ /// stopped one or This machine; the tiles still list the stopped ones.
+ #[test]
+ fn the_count_is_the_spaces_on_or_starting() {
+ use crate::host::{HostSummaryInput, this_machine_space};
+ let hosting = HostSummaryInput {
+ configured: true,
+ service_running: true,
+ sharing: true,
+ ..Default::default()
+ };
+ let this_mac = this_machine_space(Some(&hosting), 0, SpaceOs::Macos);
+ let mut stopped = row();
+ stopped.id = "local:a".into();
+ stopped.provider = "local".into();
+ stopped.reachable = false;
+ stopped.power = Some("stop".into());
+ stopped.power_state = Some("stopped".into());
+ let mut running = stopped.clone();
+ running.id = "local:b".into();
+ running.reachable = true;
+ running.power_state = Some("running".into());
+ let mut out = vec![this_mac.clone()];
+ for (i, r) in [&stopped, &stopped, &stopped, &stopped].iter().enumerate() {
+ let mut s = row_to_space(r, 0);
+ s.id = format!("local:s{i}");
+ out.push(s);
+ }
+ assert!(!is_on(&this_mac));
+ assert_eq!(openable_count(&out), 4);
+ assert_eq!(on_count(&out), 0);
+ assert_eq!(on_status_line(on_count(&out)), "No Spaces running");
+ // Turning one on counts it at once.
+ out[1].power.as_mut().unwrap().turning_on = Some(true);
+ assert_eq!(on_count(&out), 1);
+ assert_eq!(on_status_line(1), "1 Space running");
+ // A running one counts; turning off counts until it is off.
+ out.push(row_to_space(&running, 0));
+ assert_eq!(on_count(&out), 2);
+ out[2].status = SpaceStatus::Running;
+ out[2].power.as_mut().unwrap().turning_on = Some(false);
+ assert_eq!(on_count(&out), 3);
+ assert_eq!(on_status_line(3), "3 Spaces running");
+ }
}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/window.rs b/libs/cua/crates/cua-spaces-app-core/src/window.rs
index 9c9e1e6db3..3e0a3aeb8e 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/window.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/window.rs
@@ -232,11 +232,11 @@ pub fn volume_sync_word(sync: &crate::drive_page::DriveSyncInput, now_ms: u64) -
}
}
-/// The menu for `input`: the Spaces the user can open (the notch's count)
+/// The menu for `input`: the Spaces on or starting (the notch's count)
/// with Cua Volume's sync state next to it, its conflicts (they open the
/// Volume page), then the actions.
pub fn menu(input: &MenuInput) -> Vec<MenuItem> {
- let n = crate::spaces::openable_count(&input.spaces);
+ let n = crate::spaces::on_count(&input.spaces);
let alone = |s: &&crate::drive_page::DriveSyncInput| {
input.backend.as_deref() == Some("fs")
&& !s
@@ -249,6 +249,7 @@ pub fn menu(input: &MenuInput) -> Vec<MenuItem> {
.as_ref()
.filter(|s| !alone(s) && volume_shown(input.experiments.as_ref()));
let mut items = menu_bar_with_keyvault(n, input.keyvault.as_deref());
+ items[0].label = crate::spaces::on_status_line(n);
if let Some(word) = sync.and_then(|s| volume_sync_word(s, input.now_ms)) {
items[0].label = format!("{} \u{b7} {word}", items[0].label);
}
@@ -408,7 +409,7 @@ mod tests {
..Default::default()
});
assert_eq!(tab.count, want.to_string());
- assert_eq!(items[0].label, crate::spaces::status_line(want));
+ assert_eq!(items[0].label, crate::spaces::on_status_line(want));
}
}
}
diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
index 10b1a4ae48..05cc57aebb 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs
@@ -2334,12 +2334,26 @@ pub fn app_menu(input: AppMenuInput) -> Vec<AppMenuItem> {
core::window::menu(&input)
}
-/// The Spaces the user can open (the notch tab and the menu bar item).
+/// The Spaces the user can open (the open notch's tiles), on or not.
#[uniffi::export]
pub fn app_openable_count(spaces: Vec<AppSpace>) -> u32 {
core::spaces::openable_count(&spaces)
}
+/// The Spaces on or starting (the notch tab and the menu bar item); never
+/// This machine, a stopped Space or a failed one.
+#[uniffi::export]
+pub fn app_on_count(spaces: Vec<AppSpace>) -> u32 {
+ core::spaces::on_count(&spaces)
+}
+
+/// The menu bar item's status line for `count` Spaces on ("No Spaces
+/// running", "3 Spaces running").
+#[uniffi::export]
+pub fn app_on_status_line(count: u32) -> String {
+ core::spaces::on_status_line(count)
+}
+
/// `volume_sync_status`'s JSON as the core takes it.
#[uniffi::export]
pub fn app_drive_sync_from_json(json: String) -> Result<AppDriveSyncInput> {
diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
index 3b75439082..da5af3d702 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
@@ -1977,7 +1977,7 @@ pub struct AppNotchView {
pub prompt: Option<String>,
/// Accessibility label of the panel.
pub label: String,
- /// "N Spaces": the tab's spoken label (remote Spaces only).
+ /// "N Spaces": the tab's spoken label (Spaces on or starting only).
pub count_label: String,
/// The tab's two rows: the count over the word.
pub tab: AppNotchTab,
@@ -1990,7 +1990,8 @@ pub struct AppNotchView {
pub activity: Option<AppNotchActivity>,
/// The notch is hidden (menu bar only): draw nothing.
pub hidden: bool,
- /// The tab shows (closed, no drag in flight; a drag tucks it away).
+ /// The tab shows (closed, no drag in flight, at least one Space on or
+ /// starting; a drag tucks it away, and with none the notch is bare).
pub show_tab: bool,
/// The pointer rests on the closed notch while the dwell runs: the
/// shells grow it by [`NotchMotion::hover_scale`].
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index c99a632e17..2bbbc924a6 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -24870,7 +24870,7 @@ public struct AppNotchView: Equatable, Hashable {
*/
public var label: String
/**
- * "N Spaces": the tab's spoken label (remote Spaces only).
+ * "N Spaces": the tab's spoken label (Spaces on or starting only).
*/
public var countLabel: String
/**
@@ -24895,7 +24895,8 @@ public struct AppNotchView: Equatable, Hashable {
*/
public var hidden: Bool
/**
- * The tab shows (closed, no drag in flight; a drag tucks it away).
+ * The tab shows (closed, no drag in flight, at least one Space on or
+ * starting; a drag tucks it away, and with none the notch is bare).
*/
public var showTab: Bool
/**
@@ -24932,7 +24933,7 @@ public struct AppNotchView: Equatable, Hashable {
* Accessibility label of the panel.
*/label: String,
/**
- * "N Spaces": the tab's spoken label (remote Spaces only).
+ * "N Spaces": the tab's spoken label (Spaces on or starting only).
*/countLabel: String,
/**
* The tab's two rows: the count over the word.
@@ -24951,7 +24952,8 @@ public struct AppNotchView: Equatable, Hashable {
* The notch is hidden (menu bar only): draw nothing.
*/hidden: Bool,
/**
- * The tab shows (closed, no drag in flight; a drag tucks it away).
+ * The tab shows (closed, no drag in flight, at least one Space on or
+ * starting; a drag tucks it away, and with none the notch is bare).
*/showTab: Bool,
/**
* The pointer rests on the closed notch while the dwell runs: the
@@ -72886,6 +72888,28 @@ public func appNotificationsView(feed: [AppNotificationInput], nowMs: UInt64) ->
)
})
}
+/**
+ * The Spaces on or starting (the notch tab and the menu bar item); never
+ * This machine, a stopped Space or a failed one.
+ */
+public func appOnCount(spaces: [AppSpace]) -> UInt32 {
+ return try! FfiConverterUInt32.lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_on_count(
+ FfiConverterSequenceTypeAppSpace.lower(spaces),$0
+ )
+})
+}
+/**
+ * The menu bar item's status line for `count` Spaces on ("No Spaces
+ * running", "3 Spaces running").
+ */
+public func appOnStatusLine(count: UInt32) -> String {
+ return try! FfiConverterString.lift(try! rustCall() {
+ uniffi_cua_spaces_ffi_fn_func_app_on_status_line(
+ FfiConverterUInt32.lower(count),$0
+ )
+})
+}
/**
* A first-run action from JSON (parity flows).
*/
@@ -72978,7 +73002,7 @@ public func appOnboardingView(state: AppOnboardingState) -> AppOnboardingView {
})
}
/**
- * The Spaces the user can open (the notch tab and the menu bar item).
+ * The Spaces the user can open (the open notch's tiles), on or not.
*/
public func appOpenableCount(spaces: [AppSpace]) -> UInt32 {
return try! FfiConverterUInt32.lift(try! rustCall() {
@@ -75309,6 +75333,12 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_notifications_view() != 27432) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cua_spaces_ffi_checksum_func_app_on_count() != 27823) {
+ return InitializationResult.apiChecksumMismatch
+ }
+ if (uniffi_cua_spaces_ffi_checksum_func_app_on_status_line() != 37662) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cua_spaces_ffi_checksum_func_app_onboarding_action_from_json() != 6687) {
return InitializationResult.apiChecksumMismatch
}
@@ -75336,7 +75366,7 @@ private let initializationResult: InitializationResult = {
if (uniffi_cua_spaces_ffi_checksum_func_app_onboarding_view() != 63118) {
return InitializationResult.apiChecksumMismatch
}
- if (uniffi_cua_spaces_ffi_checksum_func_app_openable_count() != 46279) {
+ if (uniffi_cua_spaces_ffi_checksum_func_app_openable_count() != 49692) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_cua_spaces_ffi_checksum_func_app_os_icon_svg() != 43181) {
diff --git a/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h b/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h
index d40730ba44..ad4f27007b 100644
--- a/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h
+++ b/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h
@@ -1381,6 +1381,16 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_notifications_plan(RustBuffer feed,
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_notifications_view(RustBuffer feed, uint64_t now_ms, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_ON_COUNT
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_ON_COUNT
+uint32_t uniffi_cua_spaces_ffi_fn_func_app_on_count(RustBuffer spaces, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_ON_STATUS_LINE
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_ON_STATUS_LINE
+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_on_status_line(uint32_t count, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_ONBOARDING_ACTION_FROM_JSON
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_ONBOARDING_ACTION_FROM_JSON
RustBuffer uniffi_cua_spaces_ffi_fn_func_app_onboarding_action_from_json(RustBuffer json, RustCallStatus *_Nonnull out_status
@@ -3374,6 +3384,18 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_notifications_plan(void
#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_NOTIFICATIONS_VIEW
uint16_t uniffi_cua_spaces_ffi_checksum_func_app_notifications_view(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_ON_COUNT
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_ON_COUNT
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_on_count(void
+
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_ON_STATUS_LINE
+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_ON_STATUS_LINE
+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_on_status_line(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_ONBOARDING_ACTION_FROM_JSON