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.

feat(spaces): empty home with one-click Linux and macOS create (#4870)

injaneity2e4736b3ebff
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
index ad3d42553a..b500f9f379 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
@@ -413,7 +413,9 @@ public final class AppModel {
wizard.send(.choosePlacement(on: on))
}
- public func openNewSpace() async {
+ /// `quick`: the empty home's one click: that OS's default Space, created at once
+ /// when the core says it can be; else New Space opens on it and says why.
+ public func openNewSpace(quick os: AppSpaceOs? = nil) async {
async let runtimesProbe = backend.localRuntimes()
async let storageProbe = backend.localStorage()
async let pricingProbe = backend.cloudPricing()
@@ -427,6 +429,10 @@ public final class AppModel {
hosts = await hostsProbe
wizard.reset(env: wizardEnv(cloud: cloud, runtimes: runtimes, storage: storage, pricing: pricing,
gpus: gpus))
+ if let os {
+ wizard.send(.chooseOs(os: os))
+ if wizard.view.canContinue { create(wizard.view.plan); return }
+ }
showingNewSpace = true
telemetry?.record([.spaceWizard(action: "opened")])
self.cloud.onConnected = { [weak self] in self?.cloudsChanged() }
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift
index 6fa01f53ee..471d93d517 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift
@@ -389,12 +389,44 @@ struct EmptySpaces: View {
var body: some View {
let chrome = model.chrome
ContentUnavailableView {
- Text(model.rosterError == nil ? chrome.emptyTitle : "Spaces could not be loaded")
+ Label(model.rosterError == nil ? chrome.emptyTitle : "Spaces could not be loaded",
+ systemImage: "desktopcomputer")
+ } description: {
+ if model.rosterError == nil { Text(chrome.emptyDetail) }
} actions: {
- Button(chrome.emptyAction) { Task { await model.openNewSpace() } }
- .buttonStyle(.glassProminent)
+ VStack(spacing: 18) {
+ if model.rosterError == nil {
+ HStack(spacing: 12) {
+ tile("os-linux", chrome.emptyAction, chrome.emptyLinuxDetail, .linux)
+ tile("os-macos", chrome.emptyMacosAction, chrome.emptyMacosDetail, .macos)
+ }
+ }
+ Button(chrome.newSpaceLabel) { Task { await model.openNewSpace() } }
+ .buttonStyle(.glass)
+ }
+ .padding(.top, 10)
}
}
+
+ private func tile(_ icon: String, _ name: String, _ detail: String, _ os: AppSpaceOs) -> some View {
+ Button { Task { await model.openNewSpace(quick: os) } } label: {
+ HStack(spacing: 12) {
+ OsIconImage(id: icon, size: 24)
+ .frame(width: 44, height: 44)
+ .background(.fill.tertiary, in: .rect(cornerRadius: 10))
+ VStack(alignment: .leading, spacing: 2) {
+ Text(name).font(.headline)
+ Text(detail).font(.callout).foregroundStyle(.secondary)
+ }
+ }
+ .padding(.horizontal, 16)
+ .frame(width: 288, height: 80, alignment: .leading)
+ .contentShape(.rect(cornerRadius: 16))
+ }
+ .buttonStyle(.plain)
+ .glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
+ .accessibilityLabel("\(name), \(detail)")
+ }
}
/// Persistent discovery failure notice above the selected Space.
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/DiscoveryTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/DiscoveryTests.swift
index 5ef4ec59d7..111c9c8459 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/DiscoveryTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/DiscoveryTests.swift
@@ -105,6 +105,8 @@ struct DiscoveryTests {
let text = (request.results ?? []).compactMap { $0.topCandidates(1).first?.string }.joined(separator: " ")
#expect(text.contains("Could not load Spaces. Try refreshing again."))
#expect(text.contains("Spaces could not be loaded"))
+ #expect(text.contains("New Space"))
+ #expect(!text.contains("About 1 minute"))
// Export the exact bitmap OCR checked, not a separate render.
if let directory = ProcessInfo.processInfo.environment["SNAPSHOT_EXPORT_DIR"] {
let url = URL(fileURLWithPath: directory).appendingPathComponent("discovery-cold-content.png")
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
index 0c17684126..c99b4411ad 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
@@ -1140,7 +1140,7 @@ struct ParityTests {
"account: \(c.account)",
"signIn: \(dash(c.signInLabel))",
"settings: \(c.settingsLabel) \(c.settingsShortcut)",
- "empty: \(c.emptyTitle) / \(c.emptyAction)",
+ "empty: \(c.emptyTitle) / \(c.emptyDetail) / \(c.emptyAction) (\(c.emptyLinuxDetail)) / \(c.emptyMacosAction) (\(c.emptyMacosDetail))",
"volume: \(dash(c.volumeLabel))",
]
}
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift
index 4691088120..6b18f35d87 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift
@@ -453,6 +453,42 @@ struct ViewModelTests {
#expect(appDropSentText(files: files) == "notes.txt (1.0 KB) verified in /home/cua/Downloads/notes.txt")
}
+ /// Only This machine: the window stays on the empty home. One click creates
+ /// that system's default Space when this Mac can run it, and opens the
+ /// sheet on the core's refusal when it cannot.
+ @Test func thisMachineAloneOpensTheEmptyHome() async {
+ let backend = FixtureSpacesBackend(rows: [])
+ let model = makeModel(backend, host: FixtureHost())
+ await model.refresh()
+ #expect(model.selection == nil)
+ #expect(model.spaces.contains { $0.id == "this-mac" })
+
+ await model.openNewSpace(quick: .linux)
+ #expect(!model.showingNewSpace)
+ for _ in 0..<50 where backend.created.isEmpty { try? await Task.sleep(for: .milliseconds(20)) }
+ #expect(backend.created.first?.image == "ghcr.io/trycua/linux:24.04")
+ #expect(backend.created.first?.on == "local")
+
+ let refused = FixtureSpacesBackend(rows: [])
+ refused.fixtureBackends = ["docker"]
+ let mac = makeModel(refused, host: FixtureHost())
+ await mac.refresh()
+ await mac.openNewSpace(quick: .macos)
+ #expect(mac.showingNewSpace)
+ #expect(mac.wizard.view.placementError == "This Mac cannot run Lume Spaces.")
+ #expect(refused.created.isEmpty)
+
+ let both = FixtureSpacesBackend(rows: [])
+ both.fixtureBackends = ["docker", "lume"]
+ let ready = makeModel(both, host: FixtureHost())
+ await ready.refresh()
+ await ready.openNewSpace(quick: .macos)
+ #expect(!ready.showingNewSpace)
+ for _ in 0..<50 where both.created.isEmpty { try? await Task.sleep(for: .milliseconds(20)) }
+ #expect(both.created.first?.image == "ghcr.io/trycua/macos:26")
+ #expect(both.created.first?.on == "local")
+ }
+
@Test func refreshBuildsTheSidebarFromTheCore() async {
let model = makeModel()
await model.refresh()
diff --git a/apps/cua-spaces/src/components/desktop/MainWindow.test.tsx b/apps/cua-spaces/src/components/desktop/MainWindow.test.tsx
index 793df868fe..5801791896 100644
--- a/apps/cua-spaces/src/components/desktop/MainWindow.test.tsx
+++ b/apps/cua-spaces/src/components/desktop/MainWindow.test.tsx
@@ -2,6 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import { StrictMode } from "react";
import { describe, expect, it, vi } from "vitest";
import type { SpaceRow } from "../../model/spaces";
@@ -24,6 +25,7 @@ function setup(
overrides: Parameters<typeof fakeFleetBridge>[0] = {},
onboarded = true,
cloud: CloudBridge = createFakeCloudBridge(),
+ strict = false,
) {
const createSpace = vi.fn(async (config?: SpaceCreateConfig) => (config?.on === "cloud" ? ROWS[0]! : ROWS[1]!));
const setDefaultLocation = vi.fn(async (on: "local" | "cloud") => ({ value: on, source: "config" as const, path: "/tmp/cua/config.toml" }));
@@ -39,7 +41,8 @@ function setup(
});
const host = createFakeHostBridge({ onboarding: { completed: onboarded, mode: onboarded ? "client" : null } });
const installer = createFakeInstallerBridge({ plan: { installed: true, upToDate: true, onPath: true } });
- render(<MainWindow fleet={fleet} host={host} installer={installer} cloud={cloud} now={() => 1_000} />);
+ const tree = <MainWindow fleet={fleet} host={host} installer={installer} cloud={cloud} now={() => 1_000} />;
+ render(strict ? <StrictMode>{tree}</StrictMode> : tree);
return { fleet, host, installer, createSpace, setDefaultLocation };
}
@@ -553,6 +556,50 @@ describe("MainWindow launch at login", () => {
});
});
+describe("empty home", () => {
+ it("shows when the roster is only This machine", async () => {
+ setup({ listSpaces: async () => [] });
+ expect(await screen.findByRole("heading", { name: "No Spaces yet" })).toBeInTheDocument();
+ expect(screen.getByText("Choose a system for your first Space.")).toBeInTheDocument();
+ expect(screen.queryByRole("heading", { name: "This machine" })).toBeNull();
+ expect(screen.getByRole("button", { name: "Linux, About 1 minute · 3.2–7.1 GB of disk" })).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: /^macOS, About .+ download$/ })).toBeInTheDocument();
+ });
+
+ it("creates the default Linux Space once under StrictMode and shows no dialog", async () => {
+ const { createSpace } = setup({ listSpaces: async () => [] }, true, createFakeCloudBridge(), true);
+ await screen.findByRole("heading", { name: "No Spaces yet" });
+ fireEvent.click(screen.getByRole("button", { name: /^Linux,/ }));
+ await waitFor(() => expect(createSpace).toHaveBeenCalledTimes(1));
+ expect(createSpace).toHaveBeenCalledWith(
+ expect.objectContaining({ image: "ghcr.io/trycua/linux:24.04", on: "local" }),
+ expect.stringMatching(/^pending:/),
+ );
+ expect(screen.queryByRole("dialog")).toBeNull();
+ });
+
+ it("opens the wizard on the macOS refusal when Lume is not ready", async () => {
+ const { createSpace } = setup({ listSpaces: async () => [] });
+ await screen.findByRole("heading", { name: "No Spaces yet" });
+ fireEvent.click(screen.getByRole("button", { name: /^macOS,/ }));
+ expect(await screen.findByRole("dialog", { name: "New Space" })).toHaveTextContent(
+ "This Mac cannot run Lume Spaces.",
+ );
+ expect(createSpace).not.toHaveBeenCalled();
+ });
+
+ it("New Space opens the full wizard", async () => {
+ setup({ listSpaces: async () => [] });
+ await screen.findByRole("heading", { name: "No Spaces yet" });
+ const empty = screen.getByRole("heading", { name: "No Spaces yet" }).closest(".dw-empty");
+ fireEvent.click(within(empty as HTMLElement).getByRole("button", { name: "New Space" }));
+ const dialog = await screen.findByRole("dialog", { name: "New Space" });
+ expect(within(dialog).getByRole("combobox", { name: "Image" })).toHaveValue(
+ "ghcr.io/trycua/linux:24.04",
+ );
+ });
+});
+
describe("discovery failures", () => {
it("shows a safe cold error and recovers to a valid empty roster", async () => {
let changed: (() => void) | undefined;
diff --git a/apps/cua-spaces/src/components/desktop/MainWindow.tsx b/apps/cua-spaces/src/components/desktop/MainWindow.tsx
index 0b1ed16588..e4926206af 100644
--- a/apps/cua-spaces/src/components/desktop/MainWindow.tsx
+++ b/apps/cua-spaces/src/components/desktop/MainWindow.tsx
@@ -234,7 +234,7 @@ export function MainWindow({
startView === 'this-machine' || startView === 'host-setup' ? THIS_MACHINE_ID : null
);
const [query, setQuery] = useState('');
- const [wizard, setWizard] = useState(
+ const [wizard, setWizard] = useState<boolean | 'linux' | 'macos'>(
startView === 'new-space' || startView === 'new-space-resources'
);
useEffect(() => {
@@ -878,16 +878,27 @@ export function MainWindow({
) : !selected ? (
<div className="dw-empty">
<span className="dw-empty-art">
- <Sym name="square.grid.2x2" />
+ <Sym name="desktopcomputer" />
</span>
<h2>{sync.rosterError ? "Spaces could not be loaded" : chrome.emptyTitle}</h2>
- <button
- type="button"
- className="dw-btn dw-btn-primary dw-btn-lg"
- onClick={() => setWizard(true)}
- >
- {chrome.emptyAction}
- </button>
+ {!sync.rosterError && (
+ <>
+ <p>{chrome.emptyDetail}</p>
+ <div className="dw-empty-tiles">
+ {([
+ ['linux', chrome.emptyAction, chrome.emptyLinuxDetail],
+ ['macos', chrome.emptyMacosAction, chrome.emptyMacosDetail],
+ ] as const).map(([os, name, detail]) => (
+ <button key={os} type="button" className="wz-tile" aria-label={`${name}, ${detail}`} onClick={() => setWizard(os)}>
+ <span className="wz-tile-icon"><OsIconMark id={`os-${os}`} size={24} /></span>
+ <span className="wz-tile-title">{name}</span>
+ <span className="wz-tile-desc">{detail}</span>
+ </button>
+ ))}
+ </div>
+ </>
+ )}
+ <button type="button" className="dw-btn dw-btn-quiet" onClick={() => setWizard(true)}>{chrome.newSpaceLabel}</button>
</div>
) : isHost ? (
<div className="dw-content-inner">
@@ -950,6 +961,7 @@ export function MainWindow({
gpus={live ? gpus : null}
onOpenExternal={(url) => void fleet.openExternal(url).catch(() => {})}
startActions={startActions}
+ quick={typeof wizard === 'string' ? wizard : undefined}
onCreate={startCreate}
onAddByAddress={async (url, token, name) => {
const id = await sync.addSpace(url, token, name);
diff --git a/apps/cua-spaces/src/components/desktop/NewSpaceWizard.tsx b/apps/cua-spaces/src/components/desktop/NewSpaceWizard.tsx
index ed89d742da..21298a8601 100644
--- a/apps/cua-spaces/src/components/desktop/NewSpaceWizard.tsx
+++ b/apps/cua-spaces/src/components/desktop/NewSpaceWizard.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-import { Fragment, useEffect, useMemo, useState } from "react";
+import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { core } from "../../core";
import { NO_EXPERIMENTS, type Experiments } from "../../model/experiments";
@@ -74,6 +74,8 @@ export interface NewSpaceWizardProps {
onOpenExternal?: (url: string) => void;
/** Actions applied once when the sheet opens (start views for captures). */
startActions?: readonly ({ type: string } & Record<string, unknown>)[];
+ /** The empty home's one click: that OS's default Space. */
+ quick?: "linux" | "macos";
/** The user's connected clouds (the app core's `ConnectedCloud`s); the
* menu lists them only with the "Your cloud" experiment. */
clouds?: readonly ConnectedCloud[];
@@ -262,6 +264,7 @@ export function NewSpaceWizard({
gpus,
onOpenExternal,
startActions,
+ quick,
clouds,
hosts,
experiments,
@@ -300,7 +303,7 @@ export function NewSpaceWizard({
],
);
const [state, setState] = useState<WizardState>(() =>
- (startActions ?? []).reduce<WizardState>(
+ (quick ? [{ type: "choose-os", os: quick }] : (startActions ?? [])).reduce<WizardState>(
(s, action) => core<WizardState>("wizard.reduce", { state: s, action, env }),
core<WizardState>("wizard.initial", { env }),
),
@@ -308,9 +311,6 @@ export function NewSpaceWizard({
// The panel opened, was cancelled, or created a Space (the SwiftUI app
// records the same).
const telemetry = useMemo(() => telemetryProp ?? telemetryBridge(), [telemetryProp]);
- useEffect(() => {
- telemetry.recordSignals([{ type: "space-wizard", action: "opened" }]);
- }, [telemetry]);
const cancel = () => {
telemetry.recordSignals([{ type: "space-wizard", action: "cancelled" }]);
onCancel();
@@ -323,6 +323,16 @@ export function NewSpaceWizard({
setState((s) => core<WizardState>("wizard.reduce", { state: s, action: { type: "sync-default", location: defaultLocation }, env }));
}, [defaultLocation, env]);
const v = core<WizardView>("wizard.view", { state, env });
+ // Before paint, so a quick create never shows the sheet; once, because StrictMode runs mount effects twice.
+ const started = useRef(false);
+ useLayoutEffect(() => {
+ if (started.current) return;
+ started.current = true;
+ if (quick && v.canContinue) {
+ telemetry.recordSignals([{ type: "space-wizard", action: "submitted" }]);
+ onCreate(v.plan);
+ } else telemetry.recordSignals([{ type: "space-wizard", action: "opened" }]);
+ }, []);
const step = v.step;
if (v.mode === "address") {
diff --git a/apps/cua-spaces/src/model/window.ts b/apps/cua-spaces/src/model/window.ts
index 9eeaa67fbc..9c3b2f1ec4 100644
--- a/apps/cua-spaces/src/model/window.ts
+++ b/apps/cua-spaces/src/model/window.ts
@@ -259,6 +259,10 @@ export interface MainChrome {
settingsShortcut: string;
emptyTitle: string;
emptyAction: string;
+ emptyLinuxDetail: string;
+ emptyDetail: string;
+ emptyMacosAction: string;
+ emptyMacosDetail: string;
/** The sidebar's Volume page entry; null while Cua Volume is off. */
volumeLabel?: string | null;
}
diff --git a/apps/cua-spaces/src/styles/desktop.css b/apps/cua-spaces/src/styles/desktop.css
index d03e007a9d..028e783b27 100644
--- a/apps/cua-spaces/src/styles/desktop.css
+++ b/apps/cua-spaces/src/styles/desktop.css
@@ -176,11 +176,6 @@
background: var(--dw-hover);
color: var(--dw-text);
}
-.dw-btn-lg {
- height: 34px;
- padding: 0 18px;
- font-size: 13px;
-}
.dw-icon-btn {
display: inline-grid;
place-items: center;
@@ -757,6 +752,33 @@
width: 28px;
height: 28px;
}
+.dw-empty-tiles {
+ display: grid;
+ grid-template-columns: repeat(2, 288px);
+ gap: 12px;
+ margin: 14px 0 4px;
+}
+.dw-empty-tiles .wz-tile {
+ grid-template-columns: auto 1fr;
+ align-content: center;
+ gap: 2px 12px;
+ height: 80px;
+}
+.dw-empty-tiles .wz-tile-icon {
+ grid-row: span 2;
+ width: 44px;
+ height: 44px;
+}
+.dw-empty-tiles .wz-tile-icon .sf-icon {
+ width: 24px;
+ height: 24px;
+}
+.dw-empty-tiles .wz-tile-title {
+ align-self: end;
+}
+.dw-empty-tiles .wz-tile-desc {
+ align-self: start;
+}
/* ---------- Sheet (the New Space wizard) ---------- */
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-core/window.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-core/window.mdx
index 75feb448d5..4553c6500f 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/app-core/window.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-core/window.mdx
@@ -585,7 +585,11 @@ Returned by [`app_main_chrome`](#app_main_chrome).
| `settings_label` / `settingsLabel` | `String` | | "Settings". |
| `settings_shortcut` / `settingsShortcut` | `String` | | "⌘,". |
| `empty_title` / `emptyTitle` | `String` | | With no Spaces: the heading. |
-| `empty_action` / `emptyAction` | `String` | | With no Spaces: the button. |
+| `empty_action` / `emptyAction` | `String` | | With no Spaces: the default Linux Space's tile. |
+| `empty_linux_detail` / `emptyLinuxDetail` | `String` | | Under it: the time and disk. |
+| `empty_detail` / `emptyDetail` | `String` | | With no Spaces: the line under the heading. |
+| `empty_macos_action` / `emptyMacosAction` | `String` | | With no Spaces: the default macOS Space's tile. |
+| `empty_macos_detail` / `emptyMacosDetail` | `String` | | Under it: the download size. |
| `volume_label` / `volumeLabel` | `Option<String>` | | The sidebar's Volume page entry ("Volume"); none while the Cua Volume experiment is off (the page and its route are hidden; a mounted volume stays mounted). |
## `AppMenuItem` record
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/main-window.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/main-window.json
index c20f15dbaf..f0bafe4f7a 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/main-window.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/main-window.json
@@ -581,7 +581,7 @@
"account: Not signed in",
"signIn: Sign in",
"settings: Settings ⌘,",
- "empty: No Spaces yet / New Space",
+ "empty: No Spaces yet / Choose a system for your first Space. / Linux (About 1 minute · 3.2–7.1 GB of disk) / macOS (About 22 GB download)",
"volume: Volume"
]
},
@@ -594,7 +594,7 @@
"account: API key",
"signIn: -",
"settings: Settings ⌘,",
- "empty: No Spaces yet / New Space",
+ "empty: No Spaces yet / Choose a system for your first Space. / Linux (About 1 minute · 3.2–7.1 GB of disk) / macOS (About 22 GB download)",
"volume: Volume"
]
},
@@ -607,7 +607,7 @@
"account: [email protected]",
"signIn: -",
"settings: Settings ⌘,",
- "empty: No Spaces yet / New Space",
+ "empty: No Spaces yet / Choose a system for your first Space. / Linux (About 1 minute · 3.2–7.1 GB of disk) / macOS (About 22 GB download)",
"volume: Volume"
]
},
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 ed3a89a59a..a650d2b561 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/parity.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
@@ -671,9 +671,13 @@ pub mod frame {
str_of(&v["settingsShortcut"])
),
format!(
- "empty: {} / {}",
+ "empty: {} / {} / {} ({}) / {} ({})",
str_of(&v["emptyTitle"]),
- str_of(&v["emptyAction"])
+ str_of(&v["emptyDetail"]),
+ str_of(&v["emptyAction"]),
+ str_of(&v["emptyLinuxDetail"]),
+ str_of(&v["emptyMacosAction"]),
+ str_of(&v["emptyMacosDetail"])
),
format!("volume: {}", opt_str(&v["volumeLabel"])),
])
diff --git a/libs/cua/crates/cua-spaces-app-core/src/spaces/sidebar.rs b/libs/cua/crates/cua-spaces-app-core/src/spaces/sidebar.rs
index c975fadca7..a14840c3ab 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/spaces/sidebar.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/spaces/sidebar.rs
@@ -292,13 +292,12 @@ pub fn percent(permille: u32) -> String {
}
/// The selection the window shows: the chosen id if it still exists, else
-/// the first Space that is not this machine, else the first.
+/// the first Space that is not this machine (none: the empty home).
pub fn effective_selection<'a>(spaces: &'a [Space], selected_id: &str) -> Option<&'a Space> {
spaces
.iter()
.find(|s| s.id == selected_id)
.or_else(|| spaces.iter().find(|s| s.id != THIS_MACHINE_ID))
- .or_else(|| spaces.first())
}
/// Builds the sidebar for `spaces` filtered by `query`.
@@ -1139,6 +1138,30 @@ mod tests {
use super::*;
use crate::model::SpaceRow;
+ /// Only This machine is not a Space to open: an empty id selects nothing,
+ /// choosing it does, and a real Space wins over it.
+ #[test]
+ fn this_machine_alone_selects_nothing() {
+ use crate::host::this_machine_space;
+ use crate::model::SpaceOs;
+ let machine = this_machine_space(None, 0, SpaceOs::Macos);
+ assert!(effective_selection(std::slice::from_ref(&machine), "").is_none());
+ assert_eq!(
+ effective_selection(std::slice::from_ref(&machine), "this-mac").map(|s| s.id.as_str()),
+ Some("this-mac")
+ );
+ let real = super::super::row_to_space(&local_row("local:box", None, None, None), 0);
+ let both = [machine, real];
+ assert_eq!(
+ effective_selection(&both, "").map(|s| s.id.as_str()),
+ Some("local:box")
+ );
+ assert_eq!(
+ effective_selection(&both, "this-mac").map(|s| s.id.as_str()),
+ Some("this-mac")
+ );
+ }
+
/// Sharing off (the default): no Share button; on: Share, between
/// Picture in picture and Delete as before.
#[test]
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 53ff551566..de9dea5907 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/window.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/window.rs
@@ -51,8 +51,16 @@ pub struct MainChrome {
pub settings_shortcut: String,
/// With no Spaces: the heading.
pub empty_title: String,
- /// With no Spaces: the button.
+ /// With no Spaces: the default Linux Space's tile.
pub empty_action: String,
+ /// Under it: the time and disk.
+ pub empty_linux_detail: String,
+ /// With no Spaces: the line under the heading.
+ pub empty_detail: String,
+ /// With no Spaces: the default macOS Space's tile.
+ pub empty_macos_action: String,
+ /// Under it: the download size.
+ pub empty_macos_detail: String,
/// The sidebar's Volume page entry ("Volume"); none while the Cua Volume
/// experiment is off (the page and its route are hidden; a mounted
/// volume stays mounted).
@@ -80,11 +88,28 @@ pub fn chrome(input: &ChromeInput) -> MainChrome {
settings_label: "Settings".into(),
settings_shortcut: "\u{2318},".into(),
empty_title: "No Spaces yet".into(),
- empty_action: "New Space".into(),
+ empty_action: "Linux".into(),
+ // Measured (#4817); catalog sizes omit the runtime and what a Space writes.
+ empty_linux_detail: "About 1 minute \u{b7} 3.2\u{2013}7.1 GB of disk".into(),
+ empty_detail: "Choose a system for your first Space.".into(),
+ empty_macos_action: "macOS".into(),
+ empty_macos_detail: empty_macos_detail(),
volume_label: volume_shown(input.experiments.as_ref()).then(|| "Volume".into()),
}
}
+fn empty_macos_detail() -> String {
+ use crate::wizard::{picker_images, platform_size, size_text};
+ let images = picker_images();
+ let found = images.iter().find(|i| i.os == crate::SpaceOs::Macos);
+ let image = found.expect("a macOS image");
+ let cpu = crate::this_host_arch();
+ let arch = crate::run_arch(&image.arch, true, Some(cpu));
+ let row = platform_size(image, arch.as_deref());
+ let text = size_text(row.expect("a macOS download size").download);
+ format!("About {text} download")
+}
+
/// Whether Cua Volume shows (its page, the menu's sync line): with its
/// experiment on, or when the caller passes no experiments.
pub fn volume_shown(experiments: Option<&crate::experiments::Experiments>) -> bool {
diff --git a/libs/cua/crates/cua-spaces-app-core/src/wizard.rs b/libs/cua/crates/cua-spaces-app-core/src/wizard.rs
index 0023a5df1a..85686c1b69 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/wizard.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/wizard.rs
@@ -2241,7 +2241,10 @@ fn run_arch(image: &SandboxImage, placement: Location, host: Option<&str>) -> Op
}
/// The image's sizes on `arch` (else its first platform).
-fn platform_size<'a>(image: &'a SandboxImage, arch: Option<&str>) -> Option<&'a PlatformSize> {
+pub(crate) fn platform_size<'a>(
+ image: &'a SandboxImage,
+ arch: Option<&str>,
+) -> Option<&'a PlatformSize> {
let s = image.sizes.as_ref()?;
arch.and_then(|a| s.platforms.iter().find(|p| p.arch == a))
.or_else(|| s.platforms.first())
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 0f52340eb6..318f4b8e27 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
@@ -6480,8 +6480,16 @@ pub struct AppMainChrome {
pub settings_shortcut: String,
/// With no Spaces: the heading.
pub empty_title: String,
- /// With no Spaces: the button.
+ /// With no Spaces: the default Linux Space's tile.
pub empty_action: String,
+ /// Under it: the time and disk.
+ pub empty_linux_detail: String,
+ /// With no Spaces: the line under the heading.
+ pub empty_detail: String,
+ /// With no Spaces: the default macOS Space's tile.
+ pub empty_macos_action: String,
+ /// Under it: the download size.
+ pub empty_macos_detail: String,
/// The sidebar's Volume page entry ("Volume"); none while the Cua Volume
/// experiment is off (the page and its route are hidden; a mounted
/// volume stays mounted).
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index 466f4ab7cf..80f3de48b1 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -17396,9 +17396,25 @@ public struct AppMainChrome: Equatable, Hashable {
*/
public var emptyTitle: String
/**
- * With no Spaces: the button.
+ * With no Spaces: the default Linux Space's tile.
*/
public var emptyAction: String
+ /**
+ * Under it: the time and disk.
+ */
+ public var emptyLinuxDetail: String
+ /**
+ * With no Spaces: the line under the heading.
+ */
+ public var emptyDetail: String
+ /**
+ * With no Spaces: the default macOS Space's tile.
+ */
+ public var emptyMacosAction: String
+ /**
+ * Under it: the download size.
+ */
+ public var emptyMacosDetail: String
/**
* The sidebar's Volume page entry ("Volume"); none while the Cua Volume
* experiment is off (the page and its route are hidden; a mounted
@@ -17440,8 +17456,20 @@ public struct AppMainChrome: Equatable, Hashable {
* With no Spaces: the heading.
*/emptyTitle: String,
/**
- * With no Spaces: the button.
+ * With no Spaces: the default Linux Space's tile.
*/emptyAction: String,
+ /**
+ * Under it: the time and disk.
+ */emptyLinuxDetail: String,
+ /**
+ * With no Spaces: the line under the heading.
+ */emptyDetail: String,
+ /**
+ * With no Spaces: the default macOS Space's tile.
+ */emptyMacosAction: String,
+ /**
+ * Under it: the download size.
+ */emptyMacosDetail: String,
/**
* The sidebar's Volume page entry ("Volume"); none while the Cua Volume
* experiment is off (the page and its route are hidden; a mounted
@@ -17458,6 +17486,10 @@ public struct AppMainChrome: Equatable, Hashable {
self.settingsShortcut = settingsShortcut
self.emptyTitle = emptyTitle
self.emptyAction = emptyAction
+ self.emptyLinuxDetail = emptyLinuxDetail
+ self.emptyDetail = emptyDetail
+ self.emptyMacosAction = emptyMacosAction
+ self.emptyMacosDetail = emptyMacosDetail
self.volumeLabel = volumeLabel
}
@@ -17488,6 +17520,10 @@ public struct FfiConverterTypeAppMainChrome: FfiConverterRustBuffer {
settingsShortcut: FfiConverterString.read(from: &buf),
emptyTitle: FfiConverterString.read(from: &buf),
emptyAction: FfiConverterString.read(from: &buf),
+ emptyLinuxDetail: FfiConverterString.read(from: &buf),
+ emptyDetail: FfiConverterString.read(from: &buf),
+ emptyMacosAction: FfiConverterString.read(from: &buf),
+ emptyMacosDetail: FfiConverterString.read(from: &buf),
volumeLabel: FfiConverterOptionString.read(from: &buf)
)
}
@@ -17504,6 +17540,10 @@ public struct FfiConverterTypeAppMainChrome: FfiConverterRustBuffer {
FfiConverterString.write(value.settingsShortcut, into: &buf)
FfiConverterString.write(value.emptyTitle, into: &buf)
FfiConverterString.write(value.emptyAction, into: &buf)
+ FfiConverterString.write(value.emptyLinuxDetail, into: &buf)
+ FfiConverterString.write(value.emptyDetail, into: &buf)
+ FfiConverterString.write(value.emptyMacosAction, into: &buf)
+ FfiConverterString.write(value.emptyMacosDetail, into: &buf)
FfiConverterOptionString.write(value.volumeLabel, into: &buf)
}
}