Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

refactor(settings): drop the Settings dialog and new-project appearance defaults

Etienne Lescot2f5c041347e0
diff --git a/electron/ai-edition/document-service.defaults.test.ts b/electron/ai-edition/document-service.defaults.test.ts
deleted file mode 100644
index ddd7d208d..000000000
--- a/electron/ai-edition/document-service.defaults.test.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import { mkdtempSync, readFileSync, rmSync } from "node:fs";
-import os from "node:os";
-import path from "node:path";
-import { afterEach, describe, expect, it } from "vitest";
-import { getEditorSettings } from "../../src/lib/ai-edition/store/editorSettings";
-import { DEFAULT_PROJECT_APPEARANCE } from "../../src/lib/projectDefaults";
-import { DocumentService } from "./document-service";
-
-const dirs: string[] = [];
-function temp() {
- const root = mkdtempSync(path.join(os.tmpdir(), "openscreen-default-doc-"));
- dirs.push(root);
- return root;
-}
-afterEach(() => {
- for (const root of dirs.splice(0)) rmSync(root, { recursive: true, force: true });
-});
-
-describe("DocumentService project appearance defaults", () => {
- it("materializes the current defaults before the new project's first write", async () => {
- const root = temp();
- const projects = path.join(root, "projects");
- const service = new DocumentService(projects, path.join(root, "media"), undefined, () => ({
- ...DEFAULT_PROJECT_APPEARANCE,
- wallpaper: "#123456",
- padding: 22,
- }));
- const created = await service.createProject("New recording or CLI project");
- const onDisk = JSON.parse(
- readFileSync(path.join(projects, `${created.project.id}.openscreen`), "utf8"),
- );
- expect(getEditorSettings(onDisk)).toMatchObject({ wallpaper: "#123456", padding: 22 });
- expect(onDisk.assets).toEqual([]);
- expect(onDisk.annotations).toEqual([]);
- });
-
- it("never reapplies changed defaults while opening an existing project", async () => {
- const root = temp();
- let padding = 11;
- const service = new DocumentService(
- path.join(root, "projects"),
- path.join(root, "media"),
- undefined,
- () => ({ ...DEFAULT_PROJECT_APPEARANCE, padding }),
- );
- const created = await service.createProject("Existing");
- padding = 44;
- const reopened = await service.getProject(created.project.id);
- expect(getEditorSettings(reopened).padding).toBe(11);
- });
-});
diff --git a/electron/ai-edition/document-service.ts b/electron/ai-edition/document-service.ts
index 75d6fb1ab..e78a9c48e 100644
--- a/electron/ai-edition/document-service.ts
+++ b/electron/ai-edition/document-service.ts
@@ -21,10 +21,6 @@ import {
documentSchema,
migrateRawDocumentToCurrent,
} from "../../src/lib/ai-edition/schema";
-import {
- applyProjectAppearanceDefaults,
- type ProjectAppearanceDefaults,
-} from "../../src/lib/projectDefaults";
import { ensureDocumentExtensions } from "../media/extensionClip";
import { relinkProjectMedia } from "../media/projectMediaRelinker";
@@ -169,18 +165,15 @@ export class DocumentService {
* `electron` import. Optional so the tests and the CLI construct it as they always did.
*/
private readonly onProjectRead?: (document: AxcutDocument) => void;
- private readonly loadProjectDefaults?: () => ProjectAppearanceDefaults;
constructor(
projectsRoot: string,
mediaRegistryDir: string,
onProjectRead?: (document: AxcutDocument) => void,
- loadProjectDefaults?: () => ProjectAppearanceDefaults,
) {
this.projectsRoot = projectsRoot;
this.mediaRegistryDir = mediaRegistryDir;
this.onProjectRead = onProjectRead;
- this.loadProjectDefaults = loadProjectDefaults;
}
async ensureProjectsDir(): Promise<void> {
@@ -306,13 +299,10 @@ export class DocumentService {
async createProject(title: string): Promise<AxcutDocument> {
await this.ensureProjectsDir();
const projectId = createId("proj");
- const empty = createEmptyDocument({
+ const doc = createEmptyDocument({
projectId,
title: title?.trim() || "Untitled Project",
});
- const doc = this.loadProjectDefaults
- ? applyProjectAppearanceDefaults(empty, this.loadProjectDefaults())
- : empty;
await this.writeProject(doc);
return doc;
}
diff --git a/electron/app-settings.test.ts b/electron/app-settings.test.ts
index 2370c9b34..902d7a8a2 100644
--- a/electron/app-settings.test.ts
+++ b/electron/app-settings.test.ts
@@ -2,7 +2,6 @@ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
-import { DEFAULT_PROJECT_APPEARANCE } from "../src/lib/projectDefaults";
import { AppSettingsStore, DEFAULT_RECORDING_PREFERENCES } from "./app-settings";
const dirs: string[] = [];
@@ -41,33 +40,23 @@ describe("app settings store", () => {
}
});
- it("stores and resets versioned appearance and recording setup", () => {
+ it("stores the last source beside the recording preferences", () => {
const dir = temp();
const store = new AppSettingsStore(dir);
- const custom = { ...DEFAULT_PROJECT_APPEARANCE, wallpaper: "#010203", padding: 7 };
- expect(store.setAppearanceDefaults(custom).appearance).toMatchObject({ custom: true });
- store.setLastSource({
+ const source = {
platform: "win32",
kind: "screen",
id: "screen:1",
name: "Display",
displayId: "1",
- });
+ } as const;
store.setRecordingPreferences({ micEnabled: true, micDeviceId: "mic" });
- expect(store.resetRecordingSetup()).toMatchObject({
- recording: DEFAULT_RECORDING_PREFERENCES,
- lastSource: null,
- });
- expect(store.resetAppearanceDefaults().appearance).toEqual({
- version: 1,
- custom: false,
- defaults: DEFAULT_PROJECT_APPEARANCE,
- });
+ expect(store.setLastSource(source).lastSource).toEqual(source);
expect(
JSON.parse(readFileSync(path.join(dir, "recording-settings.json"), "utf8")),
- ).toMatchObject({
- projectAppearance: { version: 1, defaults: null },
- });
+ ).toMatchObject({ micEnabled: true, micDeviceId: "mic", lastSource: source });
+ expect(store.setLastSource(null).lastSource).toBeNull();
+ expect(store.getSnapshot().recording).toMatchObject({ micEnabled: true, micDeviceId: "mic" });
});
it("rejects invalid or failed writes without changing the published durable value", () => {
diff --git a/electron/app-settings.ts b/electron/app-settings.ts
index 64b31704d..a678a6c02 100644
--- a/electron/app-settings.ts
+++ b/electron/app-settings.ts
@@ -1,10 +1,5 @@
import { readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
import path from "node:path";
-import {
- DEFAULT_PROJECT_APPEARANCE,
- type ProjectAppearanceDefaults,
- parseProjectAppearanceDefaults,
-} from "../src/lib/projectDefaults";
import type { CursorCaptureMode } from "../src/lib/recordingSession";
export interface RecordingPreferences {
@@ -40,11 +35,6 @@ export interface RecordingSourceDescriptor {
export interface AppSettingsSnapshot {
recording: RecordingPreferences;
lastSource: RecordingSourceDescriptor | null;
- appearance: {
- version: 1;
- custom: boolean;
- defaults: ProjectAppearanceDefaults;
- };
}
type RawSettings = Record<string, unknown>;
@@ -115,26 +105,6 @@ function parseSource(value: unknown): RecordingSourceDescriptor | null {
return candidate as unknown as RecordingSourceDescriptor;
}
-function parseAppearance(raw: RawSettings): AppSettingsSnapshot["appearance"] {
- const value = raw.projectAppearance;
- if (!value || typeof value !== "object" || Array.isArray(value)) {
- return { version: 1, custom: false, defaults: DEFAULT_PROJECT_APPEARANCE };
- }
- const candidate = value as Record<string, unknown>;
- if (candidate.version !== 1 || candidate.defaults === null) {
- return { version: 1, custom: false, defaults: DEFAULT_PROJECT_APPEARANCE };
- }
- try {
- return {
- version: 1,
- custom: true,
- defaults: parseProjectAppearanceDefaults(candidate.defaults),
- };
- } catch {
- return { version: 1, custom: false, defaults: DEFAULT_PROJECT_APPEARANCE };
- }
-}
-
function validateRecordingPatch(patch: Partial<RecordingPreferences>): void {
const allowed = new Set(Object.keys(DEFAULT_RECORDING_PREFERENCES));
for (const [key, value] of Object.entries(patch)) {
@@ -164,7 +134,6 @@ export class AppSettingsStore {
return {
recording: parseRecording(raw),
lastSource: parseSource(raw.lastSource),
- appearance: parseAppearance(raw),
};
}
@@ -185,30 +154,4 @@ export class AppSettingsStore {
atomicWrite(this.userData, { ...raw, lastSource: source });
return this.getSnapshot();
}
-
- setAppearanceDefaults(defaults: ProjectAppearanceDefaults): AppSettingsSnapshot {
- const parsed = parseProjectAppearanceDefaults(defaults);
- const raw = readRaw(this.userData);
- atomicWrite(this.userData, {
- ...raw,
- projectAppearance: { version: 1, defaults: parsed },
- });
- return this.getSnapshot();
- }
-
- resetAppearanceDefaults(): AppSettingsSnapshot {
- const raw = readRaw(this.userData);
- atomicWrite(this.userData, { ...raw, projectAppearance: { version: 1, defaults: null } });
- return this.getSnapshot();
- }
-
- resetRecordingSetup(): AppSettingsSnapshot {
- const raw = readRaw(this.userData);
- atomicWrite(this.userData, {
- ...raw,
- ...DEFAULT_RECORDING_PREFERENCES,
- lastSource: null,
- });
- return this.getSnapshot();
- }
}
diff --git a/electron/electron-env.d.ts b/electron/electron-env.d.ts
index 4d1484c1c..f96b0f205 100644
--- a/electron/electron-env.d.ts
+++ b/electron/electron-env.d.ts
@@ -63,12 +63,6 @@ interface Window {
setRecordingPrefs: (
prefs: Partial<import("./ipc/handlers").RecordingPrefs>,
) => Promise<import("./ipc/handlers").RecordingPrefs>;
- getAppSettings: () => Promise<import("./app-settings").AppSettingsSnapshot>;
- setProjectAppearanceDefaults: (
- defaults: import("../src/lib/projectDefaults").ProjectAppearanceDefaults,
- ) => Promise<import("./app-settings").AppSettingsSnapshot>;
- resetProjectAppearanceDefaults: () => Promise<import("./app-settings").AppSettingsSnapshot>;
- resetRecordingSetup: () => Promise<import("./app-settings").AppSettingsSnapshot>;
onRecordingPrefsChanged: (
callback: (prefs: import("./ipc/handlers").RecordingPrefs) => void,
) => () => void;
diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts
index 3d6e267af..2b464240f 100644
--- a/electron/ipc/handlers.ts
+++ b/electron/ipc/handlers.ts
@@ -117,11 +117,7 @@ import { registerNativeBridgeHandlers } from "./nativeBridge";
import { createNativeMacMidCaptureErrorWatch } from "./nativeMacMidCaptureErrorWatch";
import { registerRecordingPrefsHandlers } from "./recordingPrefs";
import { RecordingStreamRegistry, registerRecordingStreamHandlers } from "./recordingStream";
-import {
- resetSelectSource,
- type SelectSourceContext,
- selectSourceWithOwnership,
-} from "./selectSourceOwnership";
+import { type SelectSourceContext, selectSourceWithOwnership } from "./selectSourceOwnership";
const PROJECT_FILE_EXTENSION = "openscreen";
export const SHORTCUTS_FILE = path.join(app.getPath("userData"), "shortcuts.json");
@@ -2095,13 +2091,8 @@ export function registerIpcHandlers(
return selectedSource;
});
- registerRecordingPrefsHandlers(
- defaultRecordingPrefs,
- getMainWindow,
- () => {
- resetSelectSource(selectSourceContext, broadcastSelectedSource);
- },
- () => BrowserWindow.getAllWindows(),
+ registerRecordingPrefsHandlers(defaultRecordingPrefs, getMainWindow, () =>
+ BrowserWindow.getAllWindows(),
);
ipcMain.handle("request-camera-access", async () => {
@@ -4607,7 +4598,6 @@ export function registerIpcHandlers(
path.join(app.getPath("userData"), "projects"),
RECORDINGS_DIR,
approveDocumentMedia,
- () => appSettings.getSnapshot().appearance.defaults,
);
// LlmConfigStore is single-instance for a duller reason — its constructor does
diff --git a/electron/ipc/recordingPrefs.test.ts b/electron/ipc/recordingPrefs.test.ts
index a6d978b85..0db57c795 100644
--- a/electron/ipc/recordingPrefs.test.ts
+++ b/electron/ipc/recordingPrefs.test.ts
@@ -32,11 +32,10 @@ afterEach(() => rmSync(dir, { recursive: true, force: true }));
function start(
getWindow: () => BrowserWindow | null = () => null,
- onResetSource: () => void = () => undefined,
getAppWindows?: () => BrowserWindow[],
) {
electron.handle.mockClear();
- registerRecordingPrefsHandlers(defaults, getWindow, onResetSource, getAppWindows);
+ registerRecordingPrefsHandlers(defaults, getWindow, getAppWindows);
const get = electron.handle.mock.calls.find(
([name]) => name === "get-recording-prefs",
)?.[1] as () => RecordingPrefs;
@@ -44,13 +43,9 @@ function start(
_event: unknown,
prefs: Partial<RecordingPrefs>,
) => RecordingPrefs;
- const reset = electron.handle.mock.calls.find(
- ([name]) => name === "reset-recording-setup",
- )?.[1] as (_event: unknown) => { recording: RecordingPrefs; lastSource: null };
return {
get,
set: (prefs: Partial<RecordingPrefs>) => set(undefined, prefs),
- reset: () => reset(undefined),
};
}
@@ -96,7 +91,6 @@ describe("recording preferences IPC", () => {
} as unknown as BrowserWindow;
const session = start(
() => first,
- undefined,
() => [first, second, first, destroyed],
);
const updated = session.set({ micEnabled: true });
@@ -106,24 +100,6 @@ describe("recording preferences IPC", () => {
expect(destroyedSend).not.toHaveBeenCalled();
});
- it("publishes the reset snapshot and runs the source reset callback", () => {
- const send = vi.fn();
- const window = {
- isDestroyed: () => false,
- webContents: { send },
- } as unknown as BrowserWindow;
- const onResetSource = vi.fn();
- const session = start(() => window, onResetSource);
- session.set({ micEnabled: true, camEnabled: true, systemAudioEnabled: true });
- send.mockClear();
-
- const snapshot = session.reset();
- expect(snapshot.recording).toEqual(defaults);
- expect(snapshot.lastSource).toBeNull();
- expect(onResetSource).toHaveBeenCalledTimes(1);
- expect(send).toHaveBeenCalledWith("recording-prefs-changed", defaults);
- });
-
it("does not publish an invalid or failed preference write", () => {
const session = start();
expect(() => session.set({ micEnabled: null } as unknown as Partial<RecordingPrefs>)).toThrow(
diff --git a/electron/ipc/recordingPrefs.ts b/electron/ipc/recordingPrefs.ts
index b80b03430..d92171465 100644
--- a/electron/ipc/recordingPrefs.ts
+++ b/electron/ipc/recordingPrefs.ts
@@ -1,5 +1,4 @@
import { app, type BrowserWindow, ipcMain } from "electron";
-import type { ProjectAppearanceDefaults } from "../../src/lib/projectDefaults";
import { AppSettingsStore } from "../app-settings";
import type { RecordingPrefs } from "./handlers";
@@ -7,7 +6,6 @@ import type { RecordingPrefs } from "./handlers";
export function registerRecordingPrefsHandlers(
defaults: RecordingPrefs,
getMainWindow: () => BrowserWindow | null,
- onResetSource: () => void = () => undefined,
getAppWindows: () => BrowserWindow[] = () => {
const mainWindow = getMainWindow();
return mainWindow ? [mainWindow] : [];
@@ -32,17 +30,4 @@ export function registerRecordingPrefsHandlers(
publish();
return recordingPrefs;
});
-
- ipcMain.handle("get-app-settings", () => settings.getSnapshot());
- ipcMain.handle("set-project-appearance-defaults", (_, value: ProjectAppearanceDefaults) =>
- settings.setAppearanceDefaults(value),
- );
- ipcMain.handle("reset-project-appearance-defaults", () => settings.resetAppearanceDefaults());
- ipcMain.handle("reset-recording-setup", () => {
- const snapshot = settings.resetRecordingSetup();
- recordingPrefs = snapshot.recording;
- onResetSource();
- publish();
- return snapshot;
- });
}
diff --git a/electron/ipc/selectSourceOwnership.test.ts b/electron/ipc/selectSourceOwnership.test.ts
index 88d839af2..8aaaf9258 100644
--- a/electron/ipc/selectSourceOwnership.test.ts
+++ b/electron/ipc/selectSourceOwnership.test.ts
@@ -1,9 +1,5 @@
import { describe, expect, it, vi } from "vitest";
-import {
- resetSelectSource,
- type SelectSourceContext,
- selectSourceWithOwnership,
-} from "./selectSourceOwnership";
+import { type SelectSourceContext, selectSourceWithOwnership } from "./selectSourceOwnership";
type Live = { id: string; name: string; display_id: string };
@@ -42,37 +38,6 @@ const sourceA: Live = { id: "screen:a", name: "Display A", display_id: "1" };
const sourceB: Live = { id: "screen:b", name: "Display B", display_id: "2" };
describe("selectSourceWithOwnership", () => {
- it("does not restore A after reset while A is still enumerating", async () => {
- const harness = createContext();
- let resolveA!: (sources: Live[]) => void;
- const persist = vi.fn();
- const broadcast = vi.fn();
- const pendingA = selectSourceWithOwnership(
- harness.ctx,
- sourceA,
- { persist: true },
- {
- getSources: () =>
- new Promise<Live[]>((resolve) => {
- resolveA = resolve;
- }),
- persist,
- broadcast,
- shouldPersist: () => true,
- },
- );
-
- resetSelectSource(harness.ctx, broadcast);
- expect(harness.selected.source).toBeNull();
-
- resolveA([sourceA, sourceB]);
- await pendingA;
-
- expect(harness.selected.source).toBeNull();
- expect(persist).not.toHaveBeenCalled();
- expect(broadcast).toHaveBeenLastCalledWith(null);
- });
-
it("keeps B when a slower A enumeration finishes later", async () => {
const harness = createContext();
harness.seedCache(sourceB);
diff --git a/electron/ipc/selectSourceOwnership.ts b/electron/ipc/selectSourceOwnership.ts
index 7a3339f84..3777d505a 100644
--- a/electron/ipc/selectSourceOwnership.ts
+++ b/electron/ipc/selectSourceOwnership.ts
@@ -24,15 +24,6 @@ export function bumpSelectSourceGeneration(generation: { value: number }): numbe
return generation.value;
}
-export function resetSelectSource<TLive extends { id: string; name: string; display_id: string }>(
- ctx: SelectSourceContext<TLive>,
- broadcast: (source: SelectedSourceSnapshot | null) => void,
-): void {
- bumpSelectSourceGeneration(ctx.generation);
- ctx.setSelected(null, null);
- broadcast(null);
-}
-
export async function selectSourceWithOwnership<
TLive extends { id: string; name: string; display_id: string },
>(
diff --git a/electron/preload.ts b/electron/preload.ts
index 35699839e..4ea4cb5f3 100644
--- a/electron/preload.ts
+++ b/electron/preload.ts
@@ -2,12 +2,10 @@ import { contextBridge, ipcRenderer, webUtils } from "electron";
import type { NativeLinuxRecordingRequest } from "../src/lib/nativeLinuxRecording";
import type { NativeMacRecordingRequest } from "../src/lib/nativeMacRecording";
import type { NativeWindowsRecordingRequest } from "../src/lib/nativeWindowsRecording";
-import type { ProjectAppearanceDefaults } from "../src/lib/projectDefaults";
import type { RecordingSession, StoreRecordedSessionInput } from "../src/lib/recordingSession";
import type { ShortcutBinding } from "../src/lib/shortcuts";
import type { AiEditionChatEvent } from "../src/native/contracts";
import { NATIVE_BRIDGE_CHANNEL, type NativeBridgeRequest } from "../src/native/contracts";
-import type { AppSettingsSnapshot } from "./app-settings";
import type { RecordingPrefs } from "./ipc/handlers";
import type {
SttStatusEvent,
@@ -136,13 +134,6 @@ contextBridge.exposeInMainWorld("electronAPI", {
setRecordingPrefs: (prefs: Partial<RecordingPrefs>) => {
return ipcRenderer.invoke("set-recording-prefs", prefs);
},
- getAppSettings: () => ipcRenderer.invoke("get-app-settings") as Promise<AppSettingsSnapshot>,
- setProjectAppearanceDefaults: (defaults: ProjectAppearanceDefaults) =>
- ipcRenderer.invoke("set-project-appearance-defaults", defaults) as Promise<AppSettingsSnapshot>,
- resetProjectAppearanceDefaults: () =>
- ipcRenderer.invoke("reset-project-appearance-defaults") as Promise<AppSettingsSnapshot>,
- resetRecordingSetup: () =>
- ipcRenderer.invoke("reset-recording-setup") as Promise<AppSettingsSnapshot>,
onRecordingPrefsChanged: (callback: (prefs: RecordingPrefs) => void) => {
const listener = (_event: unknown, prefs: RecordingPrefs) => callback(prefs);
ipcRenderer.on("recording-prefs-changed", listener);
diff --git a/src/App.tsx b/src/App.tsx
index 163632f11..aa7619d26 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -35,11 +35,6 @@ const ProviderSettingsDialog = lazy(() =>
default: module.ProviderSettingsDialog,
})),
);
-const AppSettingsDialog = lazy(() =>
- import("./components/ai-edition/AppSettings").then((module) => ({
- default: module.AppSettingsDialog,
- })),
-);
export default function App() {
const [windowType, setWindowType] = useState(
@@ -151,7 +146,6 @@ export default function App() {
<VideoEditorEntry />
<ShortcutsConfigDialog />
<ProviderSettingsDialog />
- <AppSettingsDialog />
</Suspense>
</EditorDialogsProvider>
</ShortcutsProvider>
diff --git a/src/components/ai-edition/AppSettings.test.tsx b/src/components/ai-edition/AppSettings.test.tsx
deleted file mode 100644
index e2d6d08da..000000000
--- a/src/components/ai-edition/AppSettings.test.tsx
+++ /dev/null
@@ -1,249 +0,0 @@
-// @vitest-environment jsdom
-import "@testing-library/jest-dom";
-import { fireEvent, render, screen, waitFor } from "@testing-library/react";
-import { beforeEach, describe, expect, it, vi } from "vitest";
-import { EditorDialogsProvider, useEditorDialogActions } from "@/contexts/EditorDialogsContext";
-import { createEmptyDocument } from "@/lib/ai-edition/schema";
-import { DEFAULT_PROJECT_APPEARANCE } from "@/lib/projectDefaults";
-import { AppSettingsDialog } from "./AppSettings";
-
-const project = vi.hoisted(() => ({
- document: null as ReturnType<typeof createEmptyDocument> | null,
-}));
-vi.mock("@/lib/ai-edition/store/projectStore", () => ({
- useProjectStore: (selector: (state: typeof project) => unknown) => selector(project),
-}));
-const microphoneHook = vi.hoisted(() => ({
- enabled: [] as boolean[],
- selectedDeviceId: "mic-live",
- devices: [{ deviceId: "mic-live", label: "Live microphone", groupId: "g" }],
- isReady: true,
-}));
-vi.mock("@/hooks/useMicrophoneDevices", () => ({
- useMicrophoneDevices: (enabled: boolean) => {
- microphoneHook.enabled.push(enabled);
- return {
- devices: microphoneHook.devices,
- selectedDeviceId: microphoneHook.selectedDeviceId,
- setSelectedDeviceId: vi.fn(),
- isReady: microphoneHook.isReady,
- };
- },
-}));
-vi.mock("@/hooks/useCameraDevices", () => ({
- useCameraDevices: () => ({
- devices: [{ deviceId: "cam-live", label: "Live camera", groupId: "g" }],
- selectedDeviceId: "cam-live",
- setSelectedDeviceId: vi.fn(),
- isReady: true,
- }),
-}));
-vi.mock("@/contexts/I18nContext", () => ({
- useScopedT: () => (key: string, vars?: Record<string, string>) =>
- vars ? `${key}:${Object.values(vars).join(":")}` : key,
-}));
-
-const recording = {
- micEnabled: false,
- micDeviceId: null,
- micDeviceName: null,
- camEnabled: false,
- camDeviceId: null,
- camDeviceName: null,
- systemAudioEnabled: false,
- cursorCaptureMode: "editable-overlay" as const,
-};
-const snapshot = {
- recording,
- lastSource: null,
- appearance: { version: 1 as const, custom: false, defaults: DEFAULT_PROJECT_APPEARANCE },
-};
-
-function OpenSettings() {
- const { openDialog, closeDialog } = useEditorDialogActions();
- return (
- <>
- <button type="button" onClick={() => openDialog("settings")}>
- open settings
- </button>
- <button type="button" onClick={closeDialog}>
- close settings
- </button>
- </>
- );
-}
-
-function renderSettings() {
- render(
- <EditorDialogsProvider>
- <OpenSettings />
- <AppSettingsDialog />
- </EditorDialogsProvider>,
- );
- fireEvent.click(screen.getByText("open settings"));
-}
-
-describe("AppSettings", () => {
- beforeEach(() => {
- microphoneHook.enabled = [];
- microphoneHook.selectedDeviceId = "mic-live";
- microphoneHook.devices = [{ deviceId: "mic-live", label: "Live microphone", groupId: "g" }];
- microphoneHook.isReady = true;
- project.document = createEmptyDocument({ projectId: "proj_settings", title: "Settings" });
- window.electronAPI = {
- getAppSettings: vi.fn(async () => snapshot),
- setRecordingPrefs: vi.fn(async (value) => ({ ...recording, ...value })),
- setProjectAppearanceDefaults: vi.fn(async (defaults) => ({
- ...snapshot,
- appearance: { version: 1 as const, custom: true, defaults },
- })),
- resetProjectAppearanceDefaults: vi.fn(async () => snapshot),
- resetRecordingSetup: vi.fn(async () => snapshot),
- } as unknown as typeof window.electronAPI;
- });
-
- it("does not enable microphone enumeration until the microphone is on", async () => {
- renderSettings();
- await screen.findByTestId("app-settings-dialog");
- expect(microphoneHook.enabled.at(-1)).toBe(false);
- fireEvent.click(screen.getByLabelText("appSettings.microphone"));
- expect(microphoneHook.enabled.at(-1)).toBe(true);
- });
-
- it("loads settings and saves edited recording toggles", async () => {
- renderSettings();
- expect(await screen.findByTestId("app-settings-dialog")).toBeInTheDocument();
- fireEvent.click(screen.getByLabelText("appSettings.systemAudio"));
- fireEvent.click(screen.getByText("appSettings.saveRecording"));
- await waitFor(() =>
- expect(window.electronAPI.setRecordingPrefs).toHaveBeenCalledWith(
- expect.objectContaining({ systemAudioEnabled: true }),
- ),
- );
- expect(await screen.findByRole("status")).toHaveTextContent("appSettings.saved");
- });
-
- it("shows a failed save and never reports Saved", async () => {
- vi.mocked(window.electronAPI.setRecordingPrefs).mockRejectedValueOnce(new Error("disk full"));
- renderSettings();
- await screen.findByTestId("app-settings-dialog");
- fireEvent.click(screen.getByText("appSettings.saveRecording"));
- expect(await screen.findByRole("alert")).toHaveTextContent("disk full");
- expect(screen.queryByRole("status")).not.toBeInTheDocument();
- });
-
- it("shows a load failure without rendering stale settings", async () => {
- vi.mocked(window.electronAPI.getAppSettings).mockRejectedValueOnce(new Error("read failed"));
- renderSettings();
- expect(await screen.findByRole("alert")).toHaveTextContent("read failed");
- expect(screen.queryByText("appSettings.saveRecording")).not.toBeInTheDocument();
- });
-
- it("does not let a stale save overwrite a newer local edit", async () => {
- let finishSave!: (value: typeof recording) => void;
- vi.mocked(window.electronAPI.setRecordingPrefs).mockImplementation(
- () =>
- new Promise((resolve) => {
- finishSave = resolve;
- }),
- );
- renderSettings();
- await screen.findByTestId("app-settings-dialog");
- fireEvent.click(screen.getByLabelText("appSettings.systemAudio"));
- fireEvent.click(screen.getByText("appSettings.saveRecording"));
- fireEvent.click(screen.getByLabelText("appSettings.systemAudio"));
- expect(screen.getByLabelText("appSettings.systemAudio")).not.toBeChecked();
- finishSave({ ...recording, systemAudioEnabled: true });
- await waitFor(() =>
- expect(window.electronAPI.setRecordingPrefs).toHaveBeenCalledWith(
- expect.objectContaining({ systemAudioEnabled: true }),
- ),
- );
- expect(screen.getByLabelText("appSettings.systemAudio")).not.toBeChecked();
- expect(screen.queryByRole("status")).not.toBeInTheDocument();
- });
-
- it("clears loaded settings when a later open fails to load", async () => {
- vi.mocked(window.electronAPI.getAppSettings)
- .mockResolvedValueOnce(snapshot)
- .mockRejectedValueOnce(new Error("read failed"));
- renderSettings();
- await screen.findByText("appSettings.saveRecording");
- fireEvent.click(screen.getByText("close settings"));
- fireEvent.click(screen.getByText("open settings"));
- expect(await screen.findByRole("alert")).toHaveTextContent("read failed");
- expect(screen.queryByText("appSettings.saveRecording")).not.toBeInTheDocument();
- });
-
- it("saves the resolved microphone when the stored device has fallen back", async () => {
- vi.mocked(window.electronAPI.getAppSettings).mockResolvedValue({
- ...snapshot,
- recording: {
- ...recording,
- micEnabled: true,
- micDeviceId: "mic-stale",
- micDeviceName: "Unplugged microphone",
- },
- });
- renderSettings();
- await screen.findByTestId("app-settings-dialog");
- fireEvent.click(screen.getByText("appSettings.saveRecording"));
- await waitFor(() =>
- expect(window.electronAPI.setRecordingPrefs).toHaveBeenCalledWith(
- expect.objectContaining({
- micEnabled: true,
- micDeviceId: "mic-live",
- micDeviceName: "Live microphone",
- }),
- ),
- );
- });
-
- it("does not save while an enabled microphone is still resolving", async () => {
- microphoneHook.isReady = false;
- vi.mocked(window.electronAPI.getAppSettings).mockResolvedValue({
- ...snapshot,
- recording: { ...recording, micEnabled: true },
- });
- renderSettings();
- await screen.findByTestId("app-settings-dialog");
- expect(screen.getByText("appSettings.saveRecording").closest("button")).toBeDisabled();
- fireEvent.click(screen.getByText("appSettings.saveRecording"));
- expect(window.electronAPI.setRecordingPrefs).not.toHaveBeenCalled();
- });
-
- it("keeps an unsaved recording draft when appearance is saved", async () => {
- vi.mocked(window.electronAPI.setProjectAppearanceDefaults).mockImplementation(
- async (defaults) => ({
- recording,
- lastSource: null,
- appearance: { version: 1 as const, custom: true, defaults },
- }),
- );
- renderSettings();
- await screen.findByTestId("app-settings-dialog");
- fireEvent.click(screen.getByLabelText("appSettings.systemAudio"));
- expect(screen.getByLabelText("appSettings.systemAudio")).toBeChecked();
- fireEvent.click(screen.getByText("appSettings.useCurrentAppearance"));
- await waitFor(() => expect(window.electronAPI.setProjectAppearanceDefaults).toHaveBeenCalled());
- expect(screen.getByLabelText("appSettings.systemAudio")).toBeChecked();
- expect(window.electronAPI.setRecordingPrefs).not.toHaveBeenCalled();
- });
-
- it("copies the current look and exposes both reset actions", async () => {
- renderSettings();
- await screen.findByTestId("app-settings-dialog");
- fireEvent.click(screen.getByText("appSettings.useCurrentAppearance"));
- await waitFor(() =>
- expect(window.electronAPI.setProjectAppearanceDefaults).toHaveBeenCalledWith(
- expect.objectContaining({ padding: 50, aspectRatio: "16:9" }),
- ),
- );
- fireEvent.click(screen.getByText("appSettings.resetAppearance"));
- await waitFor(() =>
- expect(window.electronAPI.resetProjectAppearanceDefaults).toHaveBeenCalled(),
- );
- fireEvent.click(screen.getByText("appSettings.resetRecording"));
- await waitFor(() => expect(window.electronAPI.resetRecordingSetup).toHaveBeenCalled());
- });
-});
diff --git a/src/components/ai-edition/AppSettings.tsx b/src/components/ai-edition/AppSettings.tsx
deleted file mode 100644
index 87ecdac62..000000000
--- a/src/components/ai-edition/AppSettings.tsx
+++ /dev/null
@@ -1,325 +0,0 @@
-import { Camera, Loader2, Mic, Monitor, MousePointer2, RotateCcw, Save } from "lucide-react";
-import { useEffect, useRef, useState } from "react";
-import { useEditorDialogActions, useEditorDialogSection } from "@/contexts/EditorDialogsContext";
-import { useScopedT } from "@/contexts/I18nContext";
-import { useCameraDevices } from "@/hooks/useCameraDevices";
-import { useMicrophoneDevices } from "@/hooks/useMicrophoneDevices";
-import { getEditorSettings } from "@/lib/ai-edition/store/editorSettings";
-import { useProjectStore } from "@/lib/ai-edition/store/projectStore";
-import { projectAppearanceFromEditorSettings } from "@/lib/projectDefaults";
-import type { AppSettingsSnapshot, RecordingPreferences } from "../../../electron/app-settings";
-import { ModalShell } from "./Modals";
-import styles from "./NewEditorShell.module.css";
-
-type Status = "idle" | "loading" | "saving" | "saved" | "error";
-
-function AppSettings({ open, onClose }: { open: boolean; onClose: () => void }) {
- const t = useScopedT("editor");
- const document = useProjectStore((state) => state.document);
- const [snapshot, setSnapshot] = useState<AppSettingsSnapshot | null>(null);
- const [recording, setRecording] = useState<RecordingPreferences | null>(null);
- const [status, setStatus] = useState<Status>("idle");
- const [error, setError] = useState<string | null>(null);
- const generationRef = useRef(0);
-
- useEffect(() => {
- if (!open) {
- generationRef.current += 1;
- return;
- }
- const generation = ++generationRef.current;
- setStatus("loading");
- setError(null);
- setSnapshot(null);
- setRecording(null);
- void window.electronAPI
- .getAppSettings()
- .then((value) => {
- if (generation !== generationRef.current) return;
- setSnapshot(value);
- setRecording(value.recording);
- setStatus("idle");
- })
- .catch((cause) => {
- if (generation !== generationRef.current) return;
- setError(cause instanceof Error ? cause.message : String(cause));
- setStatus("error");
- });
- }, [open]);
-
- const microphones = useMicrophoneDevices(
- open && Boolean(recording?.micEnabled),
- recording?.micDeviceId ?? undefined,
- recording?.micDeviceName ?? undefined,
- );
- const cameras = useCameraDevices(
- open,
- recording?.camDeviceId ?? undefined,
- recording?.camDeviceName ?? undefined,
- );
-
- const run = async (
- work: () => Promise<AppSettingsSnapshot>,
- options: { replaceRecording?: boolean } = {},
- ) => {
- const replaceRecording = options.replaceRecording !== false;
- const generation = ++generationRef.current;
- setStatus("saving");
- setError(null);
- try {
- const next = await work();
- if (generation !== generationRef.current) return;
- setSnapshot(next);
- if (replaceRecording) {
- setRecording(next.recording);
- }
- setStatus("saved");
- } catch (cause) {
- if (generation !== generationRef.current) return;
- setError(cause instanceof Error ? cause.message : String(cause));
- setStatus("error");
- }
- };
-
- const recordingDevicesReady = recording
- ? (!recording.micEnabled || microphones.isReady) && (!recording.camEnabled || cameras.isReady)
- : false;
-
- const saveRecording = () => {
- if (!recording || !recordingDevicesReady) return;
- const payload = { ...recording };
- if (recording.micEnabled) {
- const mic = microphones.devices.find(
- (device) => device.deviceId === microphones.selectedDeviceId,
- );
- if (mic) {
- payload.micDeviceId = mic.deviceId;
- payload.micDeviceName = mic.label;
- }
- }
- if (recording.camEnabled) {
- const cam = cameras.devices.find((device) => device.deviceId === cameras.selectedDeviceId);
- if (cam) {
- payload.camDeviceId = cam.deviceId;
- payload.camDeviceName = cam.label;
- }
- }
- void run(async () => {
- const saved = await window.electronAPI.setRecordingPrefs(payload);
- const next = await window.electronAPI.getAppSettings();
- return { ...next, recording: saved };
- });
- };
- const editRecording = (patch: Partial<RecordingPreferences>) => {
- generationRef.current += 1;
- setRecording((current) => (current ? { ...current, ...patch } : current));
- setStatus("idle");
- setError(null);
- };
-
- return (
- <ModalShell
- open={open}
- onClose={onClose}
- title={t("appSettings.title")}
- subtitle={t("appSettings.subtitle")}
- wide
- >
- <div data-testid="app-settings-dialog" style={{ display: "grid", gap: 20 }}>
- {status === "loading" ? (
- <div className={styles.emptyState}>
- <Loader2 size={18} className="animate-spin" /> {t("appSettings.loading")}
- </div>
- ) : recording && snapshot ? (
- <>
- <section style={{ display: "grid", gap: 10 }}>
- <h3>
- <Monitor size={16} /> {t("appSettings.recordingTitle")}
- </h3>
- <SettingToggle
- label={t("appSettings.systemAudio")}
- checked={recording.systemAudioEnabled}
- onChange={(value) => editRecording({ systemAudioEnabled: value })}
- />
- <SettingToggle
- label={t("appSettings.microphone")}
- checked={recording.micEnabled}
- onChange={(value) => editRecording({ micEnabled: value })}
- />
- <label className={styles.field}>
- <span>
- <Mic size={14} /> {t("appSettings.microphoneDevice")}
- </span>
- <select
- value={microphones.selectedDeviceId}
- onChange={(event) => {
- const device = microphones.devices.find(
- (item) => item.deviceId === event.target.value,
- );
- if (!device) return;
- microphones.setSelectedDeviceId(device.deviceId);
- editRecording({
- micDeviceId: device.deviceId,
- micDeviceName: device.label,
- });
- }}
- >
- {microphones.devices.map((device) => (
- <option key={device.deviceId} value={device.deviceId}>
- {device.label}
- </option>
- ))}
- </select>
- </label>
- <SettingToggle
- label={t("appSettings.camera")}
- checked={recording.camEnabled}
- onChange={(value) => editRecording({ camEnabled: value })}
- />
- <label className={styles.field}>
- <span>
- <Camera size={14} /> {t("appSettings.cameraDevice")}
- </span>
- <select
- value={cameras.selectedDeviceId}
- onChange={(event) => {
- const device = cameras.devices.find(
- (item) => item.deviceId === event.target.value,
- );
- if (!device) return;
- cameras.setSelectedDeviceId(device.deviceId);
- editRecording({
- camDeviceId: device.deviceId,
- camDeviceName: device.label,
- });
- }}
- >
- {cameras.devices.map((device) => (
- <option key={device.deviceId} value={device.deviceId}>
- {device.label}
- </option>
- ))}
- </select>
- </label>
- <SettingToggle
- label={t("appSettings.editableCursor")}
- checked={recording.cursorCaptureMode === "editable-overlay"}
- onChange={(value) =>
- editRecording({
- cursorCaptureMode: value ? "editable-overlay" : "system",
- })
- }
- />
- <p>
- {t("appSettings.lastSource", {
- source: snapshot.lastSource?.name ?? t("appSettings.noSource"),
- })}
- </p>
- <div className={styles.actions}>
- <button
- type="button"
- className={`${styles.btn} ${styles.btnPrimary}`}
- onClick={saveRecording}
- disabled={status === "saving" || !recordingDevicesReady}
- >
- <Save size={14} /> {t("appSettings.saveRecording")}
- </button>
- <button
- type="button"
- className={styles.btn}
- onClick={() => void run(() => window.electronAPI.resetRecordingSetup())}
- disabled={status === "saving"}
- >
- <RotateCcw size={14} /> {t("appSettings.resetRecording")}
- </button>
- </div>
- </section>
- <section style={{ display: "grid", gap: 10 }}>
- <h3>
- <MousePointer2 size={16} /> {t("appSettings.appearanceTitle")}
- </h3>
- <p>
- {snapshot.appearance.custom
- ? t("appSettings.customAppearance")
- : t("appSettings.factoryAppearance")}
- </p>
- <p data-testid="appearance-defaults-summary">
- {t("appSettings.appearanceSummary", {
- aspect: snapshot.appearance.defaults.aspectRatio,
- padding: snapshot.appearance.defaults.padding,
- radius: snapshot.appearance.defaults.borderRadius,
- cursor: snapshot.appearance.defaults.cursorTheme,
- camera: snapshot.appearance.defaults.webcamLayoutPreset,
- })}
- </p>
- <div className={styles.actions}>
- <button
- type="button"
- className={`${styles.btn} ${styles.btnPrimary}`}
- disabled={!document || status === "saving"}
- onClick={() => {
- if (!document) return;
- const defaults = projectAppearanceFromEditorSettings(
- getEditorSettings(document),
- );
- void run(() => window.electronAPI.setProjectAppearanceDefaults(defaults), {
- replaceRecording: false,
- });
- }}
- >
- {t("appSettings.useCurrentAppearance")}
- </button>
- <button
- type="button"
- className={styles.btn}
- onClick={() =>
- void run(() => window.electronAPI.resetProjectAppearanceDefaults(), {
- replaceRecording: false,
- })
- }
- disabled={status === "saving"}
- >
- <RotateCcw size={14} /> {t("appSettings.resetAppearance")}
- </button>
- </div>
- </section>
- </>
- ) : null}
- {status === "saved" ? <p role="status">{t("appSettings.saved")}</p> : null}
- {error ? <p role="alert">{t("appSettings.saveFailed", { error })}</p> : null}
- </div>
- </ModalShell>
- );
-}
-
-function SettingToggle({
- label,
- checked,
- disabled,
- onChange,
-}: {
- label: string;
- checked: boolean;
- disabled?: boolean;
- onChange: (value: boolean) => void;
-}) {
- return (
- <label
- style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 16 }}
- >
- <span>{label}</span>
- <input
- type="checkbox"
- checked={checked}
- disabled={disabled}
- onChange={(event) => onChange(event.target.checked)}
- />
- </label>
- );
-}
-
-export function AppSettingsDialog() {
- const section = useEditorDialogSection();
- const { closeDialog } = useEditorDialogActions();
- return <AppSettings open={section === "settings"} onClose={closeDialog} />;
-}
diff --git a/src/components/ai-edition/NewEditorShell.tsx b/src/components/ai-edition/NewEditorShell.tsx
index 596ea0c67..fabfc3acb 100644
--- a/src/components/ai-edition/NewEditorShell.tsx
+++ b/src/components/ai-edition/NewEditorShell.tsx
@@ -1547,7 +1547,6 @@ export function NewEditorShell() {
save: () => void handleSave(),
export: handleExport,
openSettings: handleOpenSettings,
- openAppSettings: () => openDialog("settings"),
renameProject: handleRenameProject,
toggleChat: () => setChatOpen((v) => !v),
openProviderSettings: () => openDialog("providers"),
diff --git a/src/components/ai-edition/ProviderSettings.test.tsx b/src/components/ai-edition/ProviderSettings.test.tsx
index 63508dd53..6f20c3ebc 100644
--- a/src/components/ai-edition/ProviderSettings.test.tsx
+++ b/src/components/ai-edition/ProviderSettings.test.tsx
@@ -54,7 +54,6 @@ function TopBar({ mode }: { mode: EditorMode }) {
save: noop,
export: noop,
openSettings: noop,
- openAppSettings: noop,
renameProject: noop,
toggleChat: noop,
openProviderSettings: () => openDialog("providers"),
diff --git a/src/components/ai-edition/v4/EditorTopBar.test.tsx b/src/components/ai-edition/v4/EditorTopBar.test.tsx
index f904d88ec..087c3cc38 100644
--- a/src/components/ai-edition/v4/EditorTopBar.test.tsx
+++ b/src/components/ai-edition/v4/EditorTopBar.test.tsx
@@ -19,16 +19,15 @@ import { EditorTopBar } from "./EditorTopBar";
const noop = () => {};
-function renderTopBar(projectTitle: string | null, mode: "media" | "edit" | "rec" = "edit") {
+function renderTopBar(projectTitle: string | null) {
const onRename = vi.fn();
const onShowAbout = vi.fn();
const onCheckForUpdates = vi.fn();
const onOpenSettings = vi.fn();
- const onOpenAppSettings = vi.fn();
const onOpenProviderSettings = vi.fn();
render(
<EditorTopBar
- mode={mode}
+ mode="edit"
onModeChange={noop}
projectTitle={projectTitle}
dirty={false}
@@ -40,7 +39,6 @@ function renderTopBar(projectTitle: string | null, mode: "media" | "edit" | "rec
save: noop,
export: noop,
openSettings: onOpenSettings,
- openAppSettings: onOpenAppSettings,
renameProject: onRename,
toggleChat: noop,
openProviderSettings: onOpenProviderSettings,
@@ -49,14 +47,7 @@ function renderTopBar(projectTitle: string | null, mode: "media" | "edit" | "rec
}}
/>,
);
- return {
- onRename,
- onShowAbout,
- onCheckForUpdates,
- onOpenSettings,
- onOpenAppSettings,
- onOpenProviderSettings,
- };
+ return { onRename, onShowAbout, onCheckForUpdates, onOpenSettings, onOpenProviderSettings };
}
/** The menu reads two separate channels, and they answer different questions: `getAppInfo` for
@@ -172,25 +163,17 @@ describe("AppMenu", () => {
expect(trigger.getAttribute("style") ?? "").not.toMatch(/all\s*:\s*unset/);
});
- it("opens on click and offers app settings, shortcuts, AI settings and about", () => {
+ it("opens on click and offers shortcuts, AI settings and about", () => {
renderTopBar("Demo Project");
fireEvent.click(screen.getByRole("button", { name: /OpenScreen/ }));
expect(screen.getByRole("menu")).toBeInTheDocument();
// Exact names: the translator echoes keys, and both settings rows are labelled with a
// `…title` key, so a /title/ match would hit two items and pin neither.
expect(screen.getByRole("menuitem", { name: "title" })).toBeInTheDocument();
- expect(screen.getByRole("menuitem", { name: "appSettings.title" })).toBeInTheDocument();
expect(screen.getByRole("menuitem", { name: "providerSettings.title" })).toBeInTheDocument();
expect(screen.getByRole("menuitem", { name: /actions\.about/ })).toBeInTheDocument();
});
- it.each(["media", "edit", "rec"] as const)("opens app settings from %s mode", (mode) => {
- const { onOpenAppSettings } = renderTopBar("Demo Project", mode);
- fireEvent.click(screen.getByRole("button", { name: /OpenScreen/ }));
- fireEvent.click(screen.getByRole("menuitem", { name: "appSettings.title" }));
- expect(onOpenAppSettings).toHaveBeenCalledTimes(1);
- });
-
// Issue #420: the AI dialog used to be openable only from the chat panel, which mounts in
// Edit mode with the panel expanded. The row is unconditional here — its dialog is mounted
// in App.tsx, above every mode — so the menu does not lie in Media and Rec.
diff --git a/src/components/ai-edition/v4/EditorTopBar.tsx b/src/components/ai-edition/v4/EditorTopBar.tsx
index ea00e541d..0fa4ce90e 100644
--- a/src/components/ai-edition/v4/EditorTopBar.tsx
+++ b/src/components/ai-edition/v4/EditorTopBar.tsx
@@ -10,7 +10,6 @@ import {
PanelLeft,
RefreshCw,
Save,
- Settings,
Sparkles,
Sun,
} from "lucide-react";
@@ -29,7 +28,6 @@ export interface TopBarActions {
save: () => void;
export: () => void;
openSettings: () => void;
- openAppSettings: () => void;
renameProject: (title: string) => void;
toggleChat: () => void;
openProviderSettings: () => void;
@@ -399,15 +397,6 @@ function AppMenu({ actions }: { actions: TopBarActions }) {
</button>
{open ? (
<div ref={menuRef} className={styles.appMenu} role="menu" onKeyDown={onMenuKeyDown}>
- <button
- type="button"
- role="menuitem"
- className={styles.appMenuRow}
- onClick={run(actions.openAppSettings)}
- >
- <Settings size={15} />
- {tEditor("appSettings.title")}
- </button>
<button
type="button"
role="menuitem"
diff --git a/src/components/ai-edition/v4/RecStage.test.tsx b/src/components/ai-edition/v4/RecStage.test.tsx
index 610751fb9..7c4e5612d 100644
--- a/src/components/ai-edition/v4/RecStage.test.tsx
+++ b/src/components/ai-edition/v4/RecStage.test.tsx
@@ -194,7 +194,7 @@ describe("RecStage controls", () => {
);
});
- it("applies reset events and ignores older initial preference and source reads", async () => {
+ it("applies pushed preference events and ignores older initial preference and source reads", async () => {
let resolvePrefs: ((value: RecordingPrefs) => void) | undefined;
let resolveSource: ((value: SelectedSource) => void) | undefined;
const initialPrefs = new Promise<RecordingPrefs>((resolve) => {
diff --git a/src/contexts/EditorDialogsContext.tsx b/src/contexts/EditorDialogsContext.tsx
index 340534f21..e38c8844f 100644
--- a/src/contexts/EditorDialogsContext.tsx
+++ b/src/contexts/EditorDialogsContext.tsx
@@ -22,7 +22,7 @@ import { createContext, type ReactNode, useContext, useMemo, useState } from "re
// global shortcuts, which was only ever half an answer — this context knows about its own
// dialogs and about no others (#434). `isModalOpen` (lib/ai-edition/modalGuard) is where that
// question is asked now.
-export type EditorDialogSection = "providers" | "settings";
+export type EditorDialogSection = "providers";
interface EditorDialogsActions {
openDialog: (section: EditorDialogSection) => void;
diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.ts
index 445850c2e..de9161b48 100644
--- a/src/hooks/useScreenRecorder.ts
+++ b/src/hooks/useScreenRecorder.ts
@@ -262,8 +262,8 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
// made in the editor's Rec-mode stage (a different renderer window) carry
// over instead of this hook silently reverting to its own hardcoded
// defaults every time startNewRecording() switches to the HUD window.
- // Reset and later saves arrive on the same channel; applying every field
- // (including null devices) is what clears a live HUD after reset.
+ // Later saves from any window arrive on the same channel; applying every field
+ // (including null devices) keeps a live HUD in step with them.
useEffect(() => {
let cancelled = false;
let receivedNewerSnapshot = false;
diff --git a/src/i18n/locales/ar/editor.json b/src/i18n/locales/ar/editor.json
index f6148a84c..dcef44624 100644
--- a/src/i18n/locales/ar/editor.json
+++ b/src/i18n/locales/ar/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "المصدر",
- "selectSource": "اختيار المصدر",
"systemPicker": "سيسألك النظام عمّا تريد مشاركته",
"systemAudio": "صوت النظام",
"microphone": "الميكروفون",
@@ -114,8 +113,6 @@
"on": "تشغيل",
"off": "إيقاف",
"loading": "جارٍ التحميل...",
- "noMicrophoneFound": "لم يتم العثور على ميكروفون",
- "microphoneUnavailable": "الميكروفون غير متاح",
"noCameraFound": "لم يتم العثور على كاميرا",
"cameraAccessError": "تعذّر الوصول إلى هذه الكاميرا",
"startingCamera": "جارٍ تشغيل الكاميرا...",
@@ -370,30 +367,6 @@
"noImage": "لا توجد صورة",
"noArrowData": "لا توجد بيانات سهم"
},
- "appSettings": {
- "title": "الإعدادات",
- "subtitle": "اختر إعداد التسجيل والمظهر المستخدم للمشاريع الجديدة.",
- "loading": "جارٍ تحميل الإعدادات…",
- "recordingTitle": "إعداد التسجيل",
- "systemAudio": "صوت النظام",
- "microphone": "الميكروفون",
- "microphoneDevice": "جهاز الميكروفون",
- "camera": "الكاميرا",
- "cameraDevice": "جهاز الكاميرا",
- "editableCursor": "مؤشر قابل للتحرير",
- "lastSource": "آخر مصدر: {{source}}",
- "noSource": "لم يتم تحديد مصدر",
- "saveRecording": "حفظ إعداد التسجيل",
- "resetRecording": "إعادة ضبط إعداد التسجيل",
- "appearanceTitle": "مظهر المشروع الجديد",
- "customAppearance": "تم حفظ إعدادات مظهر مخصصة.",
- "factoryAppearance": "إعدادات المظهر الافتراضية للمصنع نشطة.",
- "useCurrentAppearance": "استخدام المظهر الحالي كإعداد افتراضي",
- "resetAppearance": "إعادة ضبط إعدادات المظهر",
- "saved": "تم الحفظ",
- "saveFailed": "تعذر حفظ الإعدادات: {{error}}",
- "appearanceSummary": "{{aspect}}، حشوة {{padding}}٪، نصف قطر {{radius}}، المؤشر {{cursor}}، الكاميرا {{camera}}"
- },
"providerSettings": {
"title": "إعدادات الذكاء الاصطناعي",
"subtitle": "اختر مزوّدًا. تُحفظ بيانات الاعتماد في سلسلة مفاتيح النظام (safeStorage).",
diff --git a/src/i18n/locales/en/editor.json b/src/i18n/locales/en/editor.json
index ad3d98b64..a75b70055 100644
--- a/src/i18n/locales/en/editor.json
+++ b/src/i18n/locales/en/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "Source",
- "selectSource": "Select source",
"systemPicker": "Your system will ask what to share",
"systemAudio": "System audio",
"microphone": "Microphone",
@@ -114,8 +113,6 @@
"on": "On",
"off": "Off",
"loading": "Loading…",
- "noMicrophoneFound": "No microphone found",
- "microphoneUnavailable": "Microphone unavailable",
"noCameraFound": "No camera found",
"cameraAccessError": "Couldn't access this camera",
"startingCamera": "Starting camera…",
@@ -370,30 +367,6 @@
"noImage": "No image",
"noArrowData": "No arrow data"
},
- "appSettings": {
- "title": "Settings",
- "subtitle": "Choose the recording setup and the appearance used by new projects.",
- "loading": "Loading settings…",
- "recordingTitle": "Recording setup",
- "systemAudio": "System audio",
- "microphone": "Microphone",
- "microphoneDevice": "Microphone device",
- "camera": "Camera",
- "cameraDevice": "Camera device",
- "editableCursor": "Editable cursor",
- "lastSource": "Last source: {{source}}",
- "noSource": "No source selected",
- "saveRecording": "Save recording setup",
- "resetRecording": "Reset recording setup",
- "appearanceTitle": "New-project appearance",
- "customAppearance": "Custom appearance defaults are saved.",
- "factoryAppearance": "Factory appearance defaults are active.",
- "useCurrentAppearance": "Use current appearance as defaults",
- "resetAppearance": "Reset appearance defaults",
- "saved": "Saved",
- "saveFailed": "Could not save settings: {{error}}",
- "appearanceSummary": "{{aspect}}, {{padding}}% padding, radius {{radius}}, cursor {{cursor}}, camera {{camera}}"
- },
"providerSettings": {
"title": "AI settings",
"subtitle": "Choose a provider. Credentials are stored in the OS keychain (safeStorage).",
diff --git a/src/i18n/locales/es/editor.json b/src/i18n/locales/es/editor.json
index f104d05a4..9487e6b70 100644
--- a/src/i18n/locales/es/editor.json
+++ b/src/i18n/locales/es/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "Fuente",
- "selectSource": "Seleccionar fuente",
"systemPicker": "El sistema te preguntará qué compartir",
"systemAudio": "Audio del sistema",
"microphone": "Micrófono",
@@ -114,8 +113,6 @@
"on": "Activado",
"off": "Desactivado",
"loading": "Cargando…",
- "noMicrophoneFound": "No se encontró micrófono",
- "microphoneUnavailable": "Micrófono no disponible",
"noCameraFound": "No se encontró cámara",
"cameraAccessError": "No se pudo acceder a esta cámara",
"startingCamera": "Iniciando cámara…",
@@ -370,30 +367,6 @@
"noImage": "Sin imagen",
"noArrowData": "Sin datos de flecha"
},
- "appSettings": {
- "title": "Ajustes",
- "subtitle": "Elige la configuración de grabación y la apariencia de los proyectos nuevos.",
- "loading": "Cargando ajustes…",
- "recordingTitle": "Configuración de grabación",
- "systemAudio": "Audio del sistema",
- "microphone": "Micrófono",
- "microphoneDevice": "Dispositivo de micrófono",
- "camera": "Cámara",
- "cameraDevice": "Dispositivo de cámara",
- "editableCursor": "Cursor editable",
- "lastSource": "Última fuente: {{source}}",
- "noSource": "Ninguna fuente seleccionada",
- "saveRecording": "Guardar configuración de grabación",
- "resetRecording": "Restablecer configuración de grabación",
- "appearanceTitle": "Apariencia de proyectos nuevos",
- "customAppearance": "Se guardaron valores de apariencia personalizados.",
- "factoryAppearance": "Están activos los valores de apariencia de fábrica.",
- "useCurrentAppearance": "Usar la apariencia actual como predeterminada",
- "resetAppearance": "Restablecer apariencia",
- "saved": "Guardado",
- "saveFailed": "No se pudieron guardar los ajustes: {{error}}",
- "appearanceSummary": "{{aspect}}, relleno {{padding}} %, radio {{radius}}, cursor {{cursor}}, cámara {{camera}}"
- },
"providerSettings": {
"title": "Ajustes de IA",
"subtitle": "Elige un proveedor. Las credenciales se guardan en el llavero del sistema (safeStorage).",
diff --git a/src/i18n/locales/fr/editor.json b/src/i18n/locales/fr/editor.json
index 8d408657a..cf0de68ee 100644
--- a/src/i18n/locales/fr/editor.json
+++ b/src/i18n/locales/fr/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "Source",
- "selectSource": "Sélectionner une source",
"systemPicker": "Le système vous demandera quoi partager",
"systemAudio": "Audio système",
"microphone": "Microphone",
@@ -114,8 +113,6 @@
"on": "Activé",
"off": "Désactivé",
"loading": "Chargement…",
- "noMicrophoneFound": "Aucun microphone trouvé",
- "microphoneUnavailable": "Microphone indisponible",
"noCameraFound": "Aucune caméra trouvée",
"cameraAccessError": "Impossible d'accéder à cette caméra",
"startingCamera": "Démarrage de la caméra…",
@@ -370,30 +367,6 @@
"noImage": "Aucune image",
"noArrowData": "Aucune donnée de flèche"
},
- "appSettings": {
- "title": "Paramètres",
- "subtitle": "Choisissez la configuration d’enregistrement et l’apparence des nouveaux projets.",
- "loading": "Chargement des paramètres…",
- "recordingTitle": "Configuration d’enregistrement",
- "systemAudio": "Audio système",
- "microphone": "Microphone",
- "microphoneDevice": "Périphérique microphone",
- "camera": "Caméra",
- "cameraDevice": "Périphérique caméra",
- "editableCursor": "Curseur modifiable",
- "lastSource": "Dernière source : {{source}}",
- "noSource": "Aucune source sélectionnée",
- "saveRecording": "Enregistrer la configuration",
- "resetRecording": "Réinitialiser la configuration",
- "appearanceTitle": "Apparence des nouveaux projets",
- "customAppearance": "Des valeurs d’apparence personnalisées sont enregistrées.",
- "factoryAppearance": "Les valeurs d’apparence d’usine sont actives.",
- "useCurrentAppearance": "Utiliser l’apparence actuelle par défaut",
- "resetAppearance": "Réinitialiser l’apparence",
- "saved": "Enregistré",
- "saveFailed": "Impossible d’enregistrer les paramètres : {{error}}",
- "appearanceSummary": "{{aspect}}, marge {{padding}} %, rayon {{radius}}, curseur {{cursor}}, caméra {{camera}}"
- },
"providerSettings": {
"title": "Paramètres IA",
"subtitle": "Choisissez un fournisseur. Les identifiants sont stockés dans le trousseau du système (safeStorage).",
diff --git a/src/i18n/locales/it/editor.json b/src/i18n/locales/it/editor.json
index 43f649b3a..9f3b35aa4 100644
--- a/src/i18n/locales/it/editor.json
+++ b/src/i18n/locales/it/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "Sorgente",
- "selectSource": "Seleziona sorgente",
"systemPicker": "Il sistema ti chiederà cosa condividere",
"systemAudio": "Audio di sistema",
"microphone": "Microfono",
@@ -114,8 +113,6 @@
"on": "Attivo",
"off": "Disattivo",
"loading": "Caricamento…",
- "noMicrophoneFound": "Nessun microfono trovato",
- "microphoneUnavailable": "Microfono non disponibile",
"noCameraFound": "Nessuna fotocamera trovata",
"cameraAccessError": "Impossibile accedere a questa fotocamera",
"startingCamera": "Avvio fotocamera…",
@@ -370,30 +367,6 @@
"noImage": "Nessuna immagine",
"noArrowData": "Nessun dato freccia"
},
- "appSettings": {
- "title": "Impostazioni",
- "subtitle": "Scegli la configurazione di registrazione e l’aspetto dei nuovi progetti.",
- "loading": "Caricamento impostazioni…",
- "recordingTitle": "Configurazione registrazione",
- "systemAudio": "Audio di sistema",
- "microphone": "Microfono",
- "microphoneDevice": "Dispositivo microfono",
- "camera": "Fotocamera",
- "cameraDevice": "Dispositivo fotocamera",
- "editableCursor": "Cursore modificabile",
- "lastSource": "Ultima sorgente: {{source}}",
- "noSource": "Nessuna sorgente selezionata",
- "saveRecording": "Salva configurazione registrazione",
- "resetRecording": "Ripristina configurazione registrazione",
- "appearanceTitle": "Aspetto dei nuovi progetti",
- "customAppearance": "Sono salvate impostazioni aspetto personalizzate.",
- "factoryAppearance": "Sono attive le impostazioni aspetto di fabbrica.",
- "useCurrentAppearance": "Usa l’aspetto corrente come predefinito",
- "resetAppearance": "Ripristina aspetto",
- "saved": "Salvato",
- "saveFailed": "Impossibile salvare le impostazioni: {{error}}",
- "appearanceSummary": "{{aspect}}, spaziatura {{padding}}%, raggio {{radius}}, cursore {{cursor}}, fotocamera {{camera}}"
- },
"providerSettings": {
"title": "Impostazioni IA",
"subtitle": "Scegli un provider. Le credenziali sono salvate nel portachiavi del sistema (safeStorage).",
diff --git a/src/i18n/locales/ja-JP/editor.json b/src/i18n/locales/ja-JP/editor.json
index 7365b191c..ca82e702f 100644
--- a/src/i18n/locales/ja-JP/editor.json
+++ b/src/i18n/locales/ja-JP/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "ソース",
- "selectSource": "ソースを選択",
"systemPicker": "共有する対象はシステムが確認します",
"systemAudio": "システム音声",
"microphone": "マイク",
@@ -114,8 +113,6 @@
"on": "オン",
"off": "オフ",
"loading": "読み込み中…",
- "noMicrophoneFound": "マイクが見つかりません",
- "microphoneUnavailable": "マイクを使用できません",
"noCameraFound": "カメラが見つかりません",
"cameraAccessError": "このカメラにアクセスできませんでした",
"startingCamera": "カメラを起動中…",
@@ -370,30 +367,6 @@
"noImage": "画像なし",
"noArrowData": "矢印データなし"
},
- "appSettings": {
- "title": "設定",
- "subtitle": "録画設定と新規プロジェクトで使う外観を選択します。",
- "loading": "設定を読み込み中…",
- "recordingTitle": "録画設定",
- "systemAudio": "システム音声",
- "microphone": "マイク",
- "microphoneDevice": "マイクデバイス",
- "camera": "カメラ",
- "cameraDevice": "カメラデバイス",
- "editableCursor": "編集可能なカーソル",
- "lastSource": "最後のソース: {{source}}",
- "noSource": "ソース未選択",
- "saveRecording": "録画設定を保存",
- "resetRecording": "録画設定をリセット",
- "appearanceTitle": "新規プロジェクトの外観",
- "customAppearance": "カスタム外観の既定値が保存されています。",
- "factoryAppearance": "工場出荷時の外観が有効です。",
- "useCurrentAppearance": "現在の外観を既定値として使用",
- "resetAppearance": "外観をリセット",
- "saved": "保存しました",
- "saveFailed": "設定を保存できませんでした: {{error}}",
- "appearanceSummary": "{{aspect}}、余白 {{padding}}%、角丸 {{radius}}、カーソル {{cursor}}、カメラ {{camera}}"
- },
"providerSettings": {
"title": "AI 設定",
"subtitle": "プロバイダーを選択してください。認証情報は OS のキーチェーン(safeStorage)に保存されます。",
diff --git a/src/i18n/locales/ko-KR/editor.json b/src/i18n/locales/ko-KR/editor.json
index 3e81b1a79..d65edaa60 100644
--- a/src/i18n/locales/ko-KR/editor.json
+++ b/src/i18n/locales/ko-KR/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "소스",
- "selectSource": "소스 선택",
"systemPicker": "공유할 대상을 시스템이 묻습니다",
"systemAudio": "시스템 오디오",
"microphone": "마이크",
@@ -114,8 +113,6 @@
"on": "켜짐",
"off": "꺼짐",
"loading": "로딩 중…",
- "noMicrophoneFound": "마이크를 찾을 수 없음",
- "microphoneUnavailable": "마이크를 사용할 수 없음",
"noCameraFound": "카메라를 찾을 수 없음",
"cameraAccessError": "이 카메라에 액세스할 수 없습니다",
"startingCamera": "카메라 시작 중…",
@@ -370,30 +367,6 @@
"noImage": "이미지 없음",
"noArrowData": "화살표 데이터 없음"
},
- "appSettings": {
- "title": "설정",
- "subtitle": "녹화 설정과 새 프로젝트에 사용할 모양을 선택하세요.",
- "loading": "설정 불러오는 중…",
- "recordingTitle": "녹화 설정",
- "systemAudio": "시스템 오디오",
- "microphone": "마이크",
- "microphoneDevice": "마이크 장치",
- "camera": "카메라",
- "cameraDevice": "카메라 장치",
- "editableCursor": "편집 가능한 커서",
- "lastSource": "마지막 소스: {{source}}",
- "noSource": "선택한 소스 없음",
- "saveRecording": "녹화 설정 저장",
- "resetRecording": "녹화 설정 초기화",
- "appearanceTitle": "새 프로젝트 모양",
- "customAppearance": "사용자 지정 모양 기본값이 저장되었습니다.",
- "factoryAppearance": "기본 모양 설정이 적용 중입니다.",
- "useCurrentAppearance": "현재 모양을 기본값으로 사용",
- "resetAppearance": "모양 초기화",
- "saved": "저장됨",
- "saveFailed": "설정을 저장할 수 없습니다: {{error}}",
- "appearanceSummary": "{{aspect}}, 여백 {{padding}}%, 반경 {{radius}}, 커서 {{cursor}}, 카메라 {{camera}}"
- },
"providerSettings": {
"title": "AI 설정",
"subtitle": "공급자를 선택하세요. 자격 증명은 OS 키체인(safeStorage)에 저장됩니다.",
diff --git a/src/i18n/locales/pt-BR/editor.json b/src/i18n/locales/pt-BR/editor.json
index 88c173f88..e913b61dc 100644
--- a/src/i18n/locales/pt-BR/editor.json
+++ b/src/i18n/locales/pt-BR/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "Fonte",
- "selectSource": "Selecionar fonte",
"systemPicker": "O sistema perguntará o que compartilhar",
"systemAudio": "Áudio do sistema",
"microphone": "Microfone",
@@ -114,8 +113,6 @@
"on": "Ativado",
"off": "Desativado",
"loading": "Carregando…",
- "noMicrophoneFound": "Nenhum microfone encontrado",
- "microphoneUnavailable": "Microfone indisponível",
"noCameraFound": "Nenhuma câmera encontrada",
"cameraAccessError": "Não foi possível acessar esta câmera",
"startingCamera": "Iniciando câmera…",
@@ -370,30 +367,6 @@
"noImage": "Sem imagem",
"noArrowData": "Sem dados de seta"
},
- "appSettings": {
- "title": "Configurações",
- "subtitle": "Escolha a configuração de gravação e a aparência dos novos projetos.",
- "loading": "Carregando configurações…",
- "recordingTitle": "Configuração de gravação",
- "systemAudio": "Áudio do sistema",
- "microphone": "Microfone",
- "microphoneDevice": "Dispositivo de microfone",
- "camera": "Câmera",
- "cameraDevice": "Dispositivo de câmera",
- "editableCursor": "Cursor editável",
- "lastSource": "Última fonte: {{source}}",
- "noSource": "Nenhuma fonte selecionada",
- "saveRecording": "Salvar configuração de gravação",
- "resetRecording": "Redefinir configuração de gravação",
- "appearanceTitle": "Aparência de novos projetos",
- "customAppearance": "Padrões de aparência personalizados estão salvos.",
- "factoryAppearance": "Os padrões de aparência de fábrica estão ativos.",
- "useCurrentAppearance": "Usar aparência atual como padrão",
- "resetAppearance": "Redefinir aparência",
- "saved": "Salvo",
- "saveFailed": "Não foi possível salvar as configurações: {{error}}",
- "appearanceSummary": "{{aspect}}, preenchimento {{padding}}%, raio {{radius}}, cursor {{cursor}}, câmera {{camera}}"
- },
"providerSettings": {
"title": "Configurações de IA",
"subtitle": "Escolha um provedor. As credenciais são armazenadas no chaveiro do sistema (safeStorage).",
diff --git a/src/i18n/locales/ru/editor.json b/src/i18n/locales/ru/editor.json
index 007324376..d0f663c41 100644
--- a/src/i18n/locales/ru/editor.json
+++ b/src/i18n/locales/ru/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "Источник",
- "selectSource": "Выбрать источник",
"systemPicker": "Система спросит, чем поделиться",
"systemAudio": "Системный звук",
"microphone": "Микрофон",
@@ -114,8 +113,6 @@
"on": "Вкл",
"off": "Выкл",
"loading": "Загрузка…",
- "noMicrophoneFound": "Микрофон не найден",
- "microphoneUnavailable": "Микрофон недоступен",
"noCameraFound": "Камера не найдена",
"cameraAccessError": "Не удалось получить доступ к этой камере",
"startingCamera": "Запуск камеры…",
@@ -370,30 +367,6 @@
"noImage": "Нет изображения",
"noArrowData": "Нет данных стрелки"
},
- "appSettings": {
- "title": "Настройки",
- "subtitle": "Выберите параметры записи и оформление новых проектов.",
- "loading": "Загрузка настроек…",
- "recordingTitle": "Параметры записи",
- "systemAudio": "Системный звук",
- "microphone": "Микрофон",
- "microphoneDevice": "Устройство микрофона",
- "camera": "Камера",
- "cameraDevice": "Устройство камеры",
- "editableCursor": "Редактируемый курсор",
- "lastSource": "Последний источник: {{source}}",
- "noSource": "Источник не выбран",
- "saveRecording": "Сохранить параметры записи",
- "resetRecording": "Сбросить параметры записи",
- "appearanceTitle": "Оформление новых проектов",
- "customAppearance": "Пользовательские параметры оформления сохранены.",
- "factoryAppearance": "Используются заводские параметры оформления.",
- "useCurrentAppearance": "Использовать текущее оформление по умолчанию",
- "resetAppearance": "Сбросить оформление",
- "saved": "Сохранено",
- "saveFailed": "Не удалось сохранить настройки: {{error}}",
- "appearanceSummary": "{{aspect}}, отступ {{padding}}%, радиус {{radius}}, курсор {{cursor}}, камера {{camera}}"
- },
"providerSettings": {
"title": "Настройки ИИ",
"subtitle": "Выберите провайдера. Учётные данные хранятся в связке ключей ОС (safeStorage).",
diff --git a/src/i18n/locales/tr/editor.json b/src/i18n/locales/tr/editor.json
index 07fa34852..b30bc78d6 100644
--- a/src/i18n/locales/tr/editor.json
+++ b/src/i18n/locales/tr/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "Kaynak",
- "selectSource": "Kaynak seç",
"systemPicker": "Sisteminiz neyi paylaşacağınızı soracak",
"systemAudio": "Sistem sesi",
"microphone": "Mikrofon",
@@ -114,8 +113,6 @@
"on": "Açık",
"off": "Kapalı",
"loading": "Yükleniyor…",
- "noMicrophoneFound": "Mikrofon bulunamadı",
- "microphoneUnavailable": "Mikrofon kullanılamıyor",
"noCameraFound": "Kamera bulunamadı",
"cameraAccessError": "Bu kameraya erişilemedi",
"startingCamera": "Kamera başlatılıyor…",
@@ -370,30 +367,6 @@
"noImage": "Görsel yok",
"noArrowData": "Ok verisi yok"
},
- "appSettings": {
- "title": "Ayarlar",
- "subtitle": "Kayıt kurulumunu ve yeni projelerde kullanılacak görünümü seçin.",
- "loading": "Ayarlar yükleniyor…",
- "recordingTitle": "Kayıt kurulumu",
- "systemAudio": "Sistem sesi",
- "microphone": "Mikrofon",
- "microphoneDevice": "Mikrofon aygıtı",
- "camera": "Kamera",
- "cameraDevice": "Kamera aygıtı",
- "editableCursor": "Düzenlenebilir imleç",
- "lastSource": "Son kaynak: {{source}}",
- "noSource": "Kaynak seçilmedi",
- "saveRecording": "Kayıt kurulumunu kaydet",
- "resetRecording": "Kayıt kurulumunu sıfırla",
- "appearanceTitle": "Yeni proje görünümü",
- "customAppearance": "Özel görünüm varsayılanları kaydedildi.",
- "factoryAppearance": "Fabrika görünüm varsayılanları etkin.",
- "useCurrentAppearance": "Geçerli görünümü varsayılan olarak kullan",
- "resetAppearance": "Görünümü sıfırla",
- "saved": "Kaydedildi",
- "saveFailed": "Ayarlar kaydedilemedi: {{error}}",
- "appearanceSummary": "{{aspect}}, dolgu %{{padding}}, yarıçap {{radius}}, imleç {{cursor}}, kamera {{camera}}"
- },
"providerSettings": {
"title": "Yapay zekâ ayarları",
"subtitle": "Bir sağlayıcı seçin. Kimlik bilgileri işletim sisteminin anahtar zincirinde (safeStorage) saklanır.",
diff --git a/src/i18n/locales/vi/editor.json b/src/i18n/locales/vi/editor.json
index 87cd729cd..60db3e563 100644
--- a/src/i18n/locales/vi/editor.json
+++ b/src/i18n/locales/vi/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "Nguồn",
- "selectSource": "Chọn nguồn",
"systemPicker": "Hệ thống sẽ hỏi bạn muốn chia sẻ gì",
"systemAudio": "Âm thanh hệ thống",
"microphone": "Micro",
@@ -114,8 +113,6 @@
"on": "Bật",
"off": "Tắt",
"loading": "Đang tải…",
- "noMicrophoneFound": "Không tìm thấy micrô",
- "microphoneUnavailable": "Micrô không khả dụng",
"noCameraFound": "Không tìm thấy máy ảnh",
"cameraAccessError": "Không thể truy cập máy ảnh này",
"startingCamera": "Đang khởi động máy ảnh…",
@@ -370,30 +367,6 @@
"noImage": "Không có hình ảnh",
"noArrowData": "Không có dữ liệu mũi tên"
},
- "appSettings": {
- "title": "Cài đặt",
- "subtitle": "Chọn thiết lập ghi và giao diện dùng cho dự án mới.",
- "loading": "Đang tải cài đặt…",
- "recordingTitle": "Thiết lập ghi",
- "systemAudio": "Âm thanh hệ thống",
- "microphone": "Micrô",
- "microphoneDevice": "Thiết bị micrô",
- "camera": "Camera",
- "cameraDevice": "Thiết bị camera",
- "editableCursor": "Con trỏ có thể chỉnh sửa",
- "lastSource": "Nguồn gần nhất: {{source}}",
- "noSource": "Chưa chọn nguồn",
- "saveRecording": "Lưu thiết lập ghi",
- "resetRecording": "Đặt lại thiết lập ghi",
- "appearanceTitle": "Giao diện dự án mới",
- "customAppearance": "Đã lưu mặc định giao diện tùy chỉnh.",
- "factoryAppearance": "Đang dùng mặc định giao diện ban đầu.",
- "useCurrentAppearance": "Dùng giao diện hiện tại làm mặc định",
- "resetAppearance": "Đặt lại giao diện",
- "saved": "Đã lưu",
- "saveFailed": "Không thể lưu cài đặt: {{error}}",
- "appearanceSummary": "{{aspect}}, khoảng đệm {{padding}}%, bán kính {{radius}}, con trỏ {{cursor}}, camera {{camera}}"
- },
"providerSettings": {
"title": "Cài đặt AI",
"subtitle": "Chọn một nhà cung cấp. Thông tin đăng nhập được lưu trong kho khóa của hệ điều hành (safeStorage).",
diff --git a/src/i18n/locales/zh-CN/editor.json b/src/i18n/locales/zh-CN/editor.json
index 5cf9e4feb..15fb5cf09 100644
--- a/src/i18n/locales/zh-CN/editor.json
+++ b/src/i18n/locales/zh-CN/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "来源",
- "selectSource": "选择来源",
"systemPicker": "系统将询问要共享的内容",
"systemAudio": "系统音频",
"microphone": "麦克风",
@@ -114,8 +113,6 @@
"on": "开",
"off": "关",
"loading": "加载中…",
- "noMicrophoneFound": "未找到麦克风",
- "microphoneUnavailable": "麦克风不可用",
"noCameraFound": "未找到摄像头",
"cameraAccessError": "无法访问该摄像头",
"startingCamera": "正在启动摄像头…",
@@ -370,30 +367,6 @@
"noImage": "无图片",
"noArrowData": "无箭头数据"
},
- "appSettings": {
- "title": "设置",
- "subtitle": "选择录制配置和新项目使用的外观。",
- "loading": "正在加载设置…",
- "recordingTitle": "录制配置",
- "systemAudio": "系统音频",
- "microphone": "麦克风",
- "microphoneDevice": "麦克风设备",
- "camera": "摄像头",
- "cameraDevice": "摄像头设备",
- "editableCursor": "可编辑光标",
- "lastSource": "上次来源:{{source}}",
- "noSource": "未选择来源",
- "saveRecording": "保存录制配置",
- "resetRecording": "重置录制配置",
- "appearanceTitle": "新项目外观",
- "customAppearance": "已保存自定义外观默认值。",
- "factoryAppearance": "当前使用出厂外观默认值。",
- "useCurrentAppearance": "将当前外观设为默认值",
- "resetAppearance": "重置外观默认值",
- "saved": "已保存",
- "saveFailed": "无法保存设置:{{error}}",
- "appearanceSummary": "{{aspect}},边距 {{padding}}%,圆角 {{radius}},光标 {{cursor}},摄像头 {{camera}}"
- },
"providerSettings": {
"title": "AI 设置",
"subtitle": "选择一个提供商。凭据存储在系统钥匙串(safeStorage)中。",
diff --git a/src/i18n/locales/zh-TW/editor.json b/src/i18n/locales/zh-TW/editor.json
index 4d2cd591e..62f162592 100644
--- a/src/i18n/locales/zh-TW/editor.json
+++ b/src/i18n/locales/zh-TW/editor.json
@@ -105,7 +105,6 @@
},
"rec": {
"source": "來源",
- "selectSource": "選擇來源",
"systemPicker": "系統將詢問要分享的內容",
"systemAudio": "系統音訊",
"microphone": "麥克風",
@@ -114,8 +113,6 @@
"on": "開",
"off": "關",
"loading": "載入中…",
- "noMicrophoneFound": "找不到麥克風",
- "microphoneUnavailable": "麥克風無法使用",
"noCameraFound": "找不到攝影機",
"cameraAccessError": "無法存取此攝影機",
"startingCamera": "正在啟動攝影機…",
@@ -370,30 +367,6 @@
"noImage": "沒有圖片",
"noArrowData": "沒有箭頭資料"
},
- "appSettings": {
- "title": "設定",
- "subtitle": "選擇錄製配置和新專案使用的外觀。",
- "loading": "正在載入設定…",
- "recordingTitle": "錄製配置",
- "systemAudio": "系統音訊",
- "microphone": "麥克風",
- "microphoneDevice": "麥克風裝置",
- "camera": "攝影機",
- "cameraDevice": "攝影機裝置",
- "editableCursor": "可編輯游標",
- "lastSource": "上次來源:{{source}}",
- "noSource": "未選擇來源",
- "saveRecording": "儲存錄製配置",
- "resetRecording": "重設錄製配置",
- "appearanceTitle": "新專案外觀",
- "customAppearance": "已儲存自訂外觀預設值。",
- "factoryAppearance": "目前使用原廠外觀預設值。",
- "useCurrentAppearance": "將目前外觀設為預設值",
- "resetAppearance": "重設外觀預設值",
- "saved": "已儲存",
- "saveFailed": "無法儲存設定:{{error}}",
- "appearanceSummary": "{{aspect}},邊距 {{padding}}%,圓角 {{radius}},游標 {{cursor}},攝影機 {{camera}}"
- },
"providerSettings": {
"title": "AI 設定",
"subtitle": "選擇一個供應商。憑證會儲存在系統金鑰鏈(safeStorage)中。",
diff --git a/src/lib/projectDefaults.test.ts b/src/lib/projectDefaults.test.ts
deleted file mode 100644
index d333e3194..000000000
--- a/src/lib/projectDefaults.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import { describe, expect, it } from "vitest";
-import { createEmptyDocument } from "@/lib/ai-edition/schema";
-import { DEFAULT_EDITOR_SETTINGS } from "@/lib/ai-edition/store/editorSettings";
-import {
- applyProjectAppearanceDefaults,
- DEFAULT_PROJECT_APPEARANCE,
- parseProjectAppearanceDefaults,
- projectAppearanceFromEditorSettings,
-} from "./projectDefaults";
-
-describe("project appearance defaults", () => {
- it("copies the appearance allowlist without media, crop, timing, or identity", () => {
- const source = {
- ...DEFAULT_EDITOR_SETTINGS,
- wallpaper: "#123456",
- padding: 12,
- cropRegion: { x: 0.2, y: 0.2, width: 0.5, height: 0.5 },
- audioGainDb: 9,
- };
- const defaults = projectAppearanceFromEditorSettings(source);
- expect(defaults).toMatchObject({ wallpaper: "#123456", padding: 12 });
- expect(defaults).not.toHaveProperty("cropRegion");
- expect(defaults).not.toHaveProperty("audioGainDb");
- expect(defaults).not.toHaveProperty("assets");
- });
-
- it("defaults a stored appearance that predates cursor auto-hide", () => {
- const { cursorAutoHide: _cursorAutoHide, cursor, ...rest } = DEFAULT_PROJECT_APPEARANCE;
- const { autoHide: _autoHide, ...legacyCursor } = cursor;
- expect(
- parseProjectAppearanceDefaults({
- ...rest,
- cursor: legacyCursor,
- }),
- ).toMatchObject({
- cursorAutoHide: false,
- cursor: { ...legacyCursor, autoHide: false },
- });
- });
-
- it("validates the complete payload and rejects partial or unsafe values", () => {
- expect(parseProjectAppearanceDefaults(DEFAULT_PROJECT_APPEARANCE)).toEqual(
- DEFAULT_PROJECT_APPEARANCE,
- );
- expect(() => parseProjectAppearanceDefaults({ padding: 10 })).toThrow(TypeError);
- expect(() =>
- parseProjectAppearanceDefaults({ ...DEFAULT_PROJECT_APPEARANCE, padding: 101 }),
- ).toThrow(TypeError);
- });
-
- it("materializes the allowlist into a new document without changing its identity", () => {
- const empty = createEmptyDocument({ projectId: "proj_defaults", title: "Defaults" });
- const next = applyProjectAppearanceDefaults(empty, {
- ...DEFAULT_PROJECT_APPEARANCE,
- wallpaper: "#abcdef",
- padding: 18,
- });
- expect(next.project).toEqual(empty.project);
- expect(next.assets).toEqual([]);
- expect(next.timeline).toEqual(empty.timeline);
- expect(next.legacyEditor).toMatchObject({ wallpaper: "#abcdef", padding: 18 });
- });
-});
diff --git a/src/lib/projectDefaults.ts b/src/lib/projectDefaults.ts
index 237e7f741..2deb8687d 100644
--- a/src/lib/projectDefaults.ts
+++ b/src/lib/projectDefaults.ts
@@ -1,5 +1,3 @@
-import type { AxcutDocument } from "./ai-edition/schema";
-
export interface ProjectAppearanceDefaults {
wallpaper: string;
aspectRatio: `${number}:${number}` | "native";
@@ -31,14 +29,7 @@ export interface ProjectAppearanceDefaults {
autoFocusAll: boolean;
}
-/** Structural input accepted from the editor settings reader without coupling this
- * main-process-safe serializer to renderer-only modules or path aliases.
- * `cursor.autoHide` is optional on the editor snapshot (#104); the stored
- * appearance defaults always materialize it as a boolean. */
-export type ProjectAppearanceSource = Omit<ProjectAppearanceDefaults, "cursor"> & {
- cursor: Omit<ProjectAppearanceDefaults["cursor"], "autoHide"> & { autoHide?: boolean };
-};
-
+/** The factory appearance every new project starts from. */
export const DEFAULT_PROJECT_APPEARANCE: ProjectAppearanceDefaults = {
wallpaper: "/wallpapers/wallpaper1.jpg",
aspectRatio: "16:9",
@@ -69,137 +60,3 @@ export const DEFAULT_PROJECT_APPEARANCE: ProjectAppearanceDefaults = {
cursorTheme: "default",
autoFocusAll: false,
};
-
-const LAYOUTS = new Set(["picture-in-picture", "vertical-stack", "dual-frame", "no-webcam"]);
-const MASK_SHAPES = new Set(["rectangle", "circle", "square", "rounded"]);
-const BACKGROUND_MODES = new Set(["none", "transparent", "blur", "custom"]);
-
-function finite(value: unknown, min: number, max: number): value is number {
- return typeof value === "number" && Number.isFinite(value) && value >= min && value <= max;
-}
-
-function isAspectRatio(value: unknown): value is string {
- if (value === "native") return true;
- if (typeof value !== "string") return false;
- const match = /^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(value);
- return Boolean(match && Number(match[1]) > 0 && Number(match[2]) > 0);
-}
-
-function position(value: unknown): value is ProjectAppearanceDefaults["webcamPosition"] {
- if (value === null) return true;
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
- const candidate = value as Record<string, unknown>;
- return finite(candidate.cx, 0, 1) && finite(candidate.cy, 0, 1);
-}
-
-function cursor(value: unknown): value is ProjectAppearanceDefaults["cursor"] {
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
- const candidate = value as Record<string, unknown>;
- return (
- finite(candidate.size, 0.1, 20) &&
- finite(candidate.smoothing, 0, 1) &&
- finite(candidate.motionBlur, 0, 1) &&
- finite(candidate.clickBounce, 0, 10) &&
- typeof candidate.clipToBounds === "boolean" &&
- (candidate.autoHide === undefined || typeof candidate.autoHide === "boolean")
- );
-}
-
-export function projectAppearanceFromEditorSettings(
- settings: ProjectAppearanceSource,
-): ProjectAppearanceDefaults {
- return {
- wallpaper: settings.wallpaper,
- aspectRatio: settings.aspectRatio,
- shadowIntensity: settings.shadowIntensity,
- showBlur: settings.showBlur,
- motionBlurAmount: settings.motionBlurAmount,
- borderRadius: settings.borderRadius,
- padding: settings.padding,
- webcamLayoutPreset: settings.webcamLayoutPreset,
- webcamMaskShape: settings.webcamMaskShape,
- webcamMirrored: settings.webcamMirrored,
- webcamReactiveZoom: settings.webcamReactiveZoom,
- webcamSizePreset: settings.webcamSizePreset,
- webcamPosition: settings.webcamPosition ? { ...settings.webcamPosition } : null,
- webcamBackgroundMode: settings.webcamBackgroundMode,
- webcamWallpaper: settings.webcamWallpaper,
- webcamBlurIntensity: settings.webcamBlurIntensity,
- cursor: { ...settings.cursor, autoHide: settings.cursor.autoHide === true },
- cursorShow: settings.cursorShow,
- cursorAutoHide: settings.cursorAutoHide === true || settings.cursor.autoHide === true,
- cursorTheme: settings.cursorTheme,
- autoFocusAll: settings.autoFocusAll,
- };
-}
-
-export function parseProjectAppearanceDefaults(value: unknown): ProjectAppearanceDefaults {
- if (!value || typeof value !== "object" || Array.isArray(value)) {
- throw new TypeError("project appearance defaults must be an object");
- }
- const candidate = value as Record<string, unknown>;
- if (
- typeof candidate.wallpaper !== "string" ||
- !isAspectRatio(candidate.aspectRatio) ||
- !finite(candidate.shadowIntensity, 0, 1) ||
- typeof candidate.showBlur !== "boolean" ||
- !finite(candidate.motionBlurAmount, 0, 1) ||
- !finite(candidate.borderRadius, 0, 500) ||
- !finite(candidate.padding, 0, 100) ||
- !LAYOUTS.has(candidate.webcamLayoutPreset as string) ||
- !MASK_SHAPES.has(candidate.webcamMaskShape as string) ||
- typeof candidate.webcamMirrored !== "boolean" ||
- typeof candidate.webcamReactiveZoom !== "boolean" ||
- !finite(candidate.webcamSizePreset, 10, 50) ||
- !position(candidate.webcamPosition) ||
- !BACKGROUND_MODES.has(candidate.webcamBackgroundMode as string) ||
- typeof candidate.webcamWallpaper !== "string" ||
- !finite(candidate.webcamBlurIntensity, 0, 1) ||
- !cursor(candidate.cursor) ||
- typeof candidate.cursorShow !== "boolean" ||
- typeof candidate.cursorTheme !== "string" ||
- candidate.cursorTheme.length === 0 ||
- typeof candidate.autoFocusAll !== "boolean"
- ) {
- throw new TypeError("project appearance defaults are invalid");
- }
- return projectAppearanceFromEditorSettings(candidate as unknown as ProjectAppearanceSource);
-}
-
-export function applyProjectAppearanceDefaults(
- document: AxcutDocument,
- defaults: ProjectAppearanceDefaults,
-): AxcutDocument {
- const parsed = parseProjectAppearanceDefaults(defaults);
- return {
- ...document,
- legacyEditor: {
- ...(document.legacyEditor ?? {}),
- wallpaper: parsed.wallpaper,
- aspectRatio: parsed.aspectRatio,
- shadowIntensity: parsed.shadowIntensity,
- showBlur: parsed.showBlur,
- motionBlurAmount: parsed.motionBlurAmount,
- borderRadius: parsed.borderRadius,
- padding: parsed.padding,
- webcamLayoutPreset: parsed.webcamLayoutPreset,
- webcamMaskShape: parsed.webcamMaskShape,
- webcamMirrored: parsed.webcamMirrored,
- webcamReactiveZoom: parsed.webcamReactiveZoom,
- webcamSizePreset: parsed.webcamSizePreset,
- webcamPosition: parsed.webcamPosition,
- webcamBackgroundMode: parsed.webcamBackgroundMode,
- webcamWallpaper: parsed.webcamWallpaper,
- webcamBlurIntensity: parsed.webcamBlurIntensity,
- cursorSize: parsed.cursor.size,
- cursorSmoothing: parsed.cursor.smoothing,
- cursorMotionBlur: parsed.cursor.motionBlur,
- cursorClickBounce: parsed.cursor.clickBounce,
- cursorClipToBounds: parsed.cursor.clipToBounds,
- cursorShow: parsed.cursorShow,
- cursorAutoHide: parsed.cursorAutoHide,
- cursorTheme: parsed.cursorTheme,
- autoFocusAll: parsed.autoFocusAll,
- },
- };
-}
diff --git a/src/lib/userPreferences.test.ts b/src/lib/userPreferences.test.ts
index 6bf436f60..ca66c53d5 100644
--- a/src/lib/userPreferences.test.ts
+++ b/src/lib/userPreferences.test.ts
@@ -1,5 +1,4 @@
import { beforeEach, describe, expect, it } from "vitest";
-import { DEFAULT_PROJECT_APPEARANCE } from "./projectDefaults";
import {
DEFAULT_PREFS,
getProjectFolder,
@@ -134,10 +133,4 @@ describe("user preferences", () => {
expect(loadUserPreferences().hideSoftwareEncoderFallbackNotice).toBe(false);
});
-
- it("keeps dormant padding and aspect values compatible without overriding project defaults", () => {
- saveUserPreferences({ padding: 3, aspectRatio: "1:1" });
- expect(loadUserPreferences()).toMatchObject({ padding: 3, aspectRatio: "1:1" });
- expect(DEFAULT_PROJECT_APPEARANCE).toMatchObject({ padding: 50, aspectRatio: "16:9" });
- });
});
diff --git a/src/lib/userPreferences.ts b/src/lib/userPreferences.ts
index 90be5916e..f98fb422d 100644
--- a/src/lib/userPreferences.ts
+++ b/src/lib/userPreferences.ts
@@ -8,9 +8,9 @@ import { type AspectRatio, isAspectRatio } from "@/utils/aspectRatioUtils";
const PREFS_KEY = "openscreen_user_preferences";
export interface UserPreferences {
- /** @deprecated Dormant compatibility field. New-project appearance uses recording-settings.json. */
+ /** Default padding % */
padding: number;
- /** @deprecated Dormant compatibility field. New-project appearance uses recording-settings.json. */
+ /** Default aspect ratio */
aspectRatio: AspectRatio;
/** Default export quality */
exportQuality: ExportQuality;
@@ -61,8 +61,6 @@ export function loadUserPreferences(): UserPreferences {
if (!raw || typeof raw !== "object") return { ...DEFAULT_PREFS };
return {
- // Kept readable for compatibility with older builds. These values are never
- // migrated into or consulted by the canonical project-appearance store.
padding:
typeof raw.padding === "number" &&
Number.isFinite(raw.padding) &&
diff --git a/src/native/browserShim.test.ts b/src/native/browserShim.test.ts
index 9ce3a647a..3360d0ddf 100644
--- a/src/native/browserShim.test.ts
+++ b/src/native/browserShim.test.ts
@@ -2,7 +2,6 @@
// The shim persists projects to localStorage, so this needs a DOM.
import { beforeAll, beforeEach, describe, expect, it } from "vitest";
import type { AxcutDocument } from "@/lib/ai-edition/schema";
-import { DEFAULT_PROJECT_APPEARANCE } from "@/lib/projectDefaults";
import { installBrowserShims } from "./browserShim";
import { nativeBridgeClient } from "./client";
@@ -60,22 +59,9 @@ describe("browserShim addAsset (issue #350)", () => {
});
});
-describe("browserShim app settings", () => {
- it("materializes versioned appearance defaults into a new browser project", async () => {
- await window.electronAPI.setProjectAppearanceDefaults({
- ...DEFAULT_PROJECT_APPEARANCE,
- wallpaper: "#abcdef",
- padding: 9,
- });
- const created = await nativeBridgeClient.aiEdition.create("Defaults");
- expect(asDoc(created.document).legacyEditor).toMatchObject({
- wallpaper: "#abcdef",
- padding: 9,
- });
- });
-
+describe("browserShim recording settings", () => {
it("publishes recording settings only after localStorage succeeds", async () => {
- await window.electronAPI.resetRecordingSetup();
+ await window.electronAPI.setRecordingPrefs({ micEnabled: false });
const setItem = Storage.prototype.setItem;
Storage.prototype.setItem = () => {
throw new Error("storage unavailable");
@@ -90,7 +76,8 @@ describe("browserShim app settings", () => {
}
});
- it("notifies recording and source subscribers on changes and reset", async () => {
+ it("notifies recording and source subscribers on changes", async () => {
+ await window.electronAPI.setRecordingPrefs({ micEnabled: false });
const prefsEvents: boolean[] = [];
const sourceEvents: Array<string | null> = [];
const stopPrefs = window.electronAPI.onRecordingPrefsChanged((prefs) =>
@@ -103,53 +90,24 @@ describe("browserShim app settings", () => {
await window.electronAPI.setRecordingPrefs({ micEnabled: true });
const source = (await window.electronAPI.getSources({ types: ["screen"] }))[0];
await window.electronAPI.selectSource(source);
- await window.electronAPI.resetRecordingSetup();
- expect(prefsEvents).toEqual([true, false]);
- expect(sourceEvents).toEqual([source.id, null]);
+ expect(prefsEvents).toEqual([true]);
+ expect(sourceEvents).toEqual([source.id]);
stopPrefs();
stopSource();
- await window.electronAPI.setRecordingPrefs({ micEnabled: true });
- expect(prefsEvents).toEqual([true, false]);
+ await window.electronAPI.setRecordingPrefs({ micEnabled: false });
+ expect(prefsEvents).toEqual([true]);
});
- it("persists the selected source unless persist is false, and reset clears it", async () => {
+ it("persists the selected source unless persist is false", async () => {
const source = (await window.electronAPI.getSources({ types: ["screen"] }))[0];
await window.electronAPI.selectSource(source, { persist: false });
expect(localStorage.getItem("browser-shim-selected-source")).toBeNull();
- expect((await window.electronAPI.getAppSettings()).lastSource).toMatchObject({
- id: source.id,
- name: source.name,
- });
+ expect(await window.electronAPI.getSelectedSource()).toMatchObject({ id: source.id });
await window.electronAPI.selectSource(source);
expect(
JSON.parse(localStorage.getItem("browser-shim-selected-source") ?? "null"),
).toMatchObject({ id: source.id });
- expect((await window.electronAPI.getAppSettings()).lastSource).toMatchObject({
- id: source.id,
- name: source.name,
- kind: "screen",
- });
-
- await window.electronAPI.resetRecordingSetup();
- expect(localStorage.getItem("browser-shim-selected-source")).toBeNull();
- expect((await window.electronAPI.getAppSettings()).lastSource).toBeNull();
- });
-
- it("getAppSettings after selectSource does not need Node process", async () => {
- const source = (await window.electronAPI.getSources({ types: ["screen"] }))[0];
- await window.electronAPI.selectSource(source);
- const original = (globalThis as { process?: unknown }).process;
- try {
- delete (globalThis as { process?: unknown }).process;
- await expect(window.electronAPI.getAppSettings()).resolves.toMatchObject({
- lastSource: { id: source.id, name: source.name },
- });
- } finally {
- if (original !== undefined) {
- (globalThis as { process?: unknown }).process = original;
- }
- }
});
});
diff --git a/src/native/browserShim.ts b/src/native/browserShim.ts
index c297ed98f..73686a113 100644
--- a/src/native/browserShim.ts
+++ b/src/native/browserShim.ts
@@ -4,19 +4,7 @@
// rapid iteration without the Electron window overhead.
import { PROVIDER_DEFINITIONS } from "../../electron/ai-edition/provider-registry";
-import { describeRecordingSource } from "../../electron/recording-source-settings";
-import {
- type AxcutDocument,
- axcutSchemaVersion,
- migrateRawDocumentToCurrent,
-} from "../lib/ai-edition/schema";
-import {
- applyProjectAppearanceDefaults,
- DEFAULT_PROJECT_APPEARANCE,
- type ProjectAppearanceDefaults,
- parseProjectAppearanceDefaults,
-} from "../lib/projectDefaults";
-import { getPlatform } from "../utils/platformUtils";
+import { axcutSchemaVersion, migrateRawDocumentToCurrent } from "../lib/ai-edition/schema";
import { nativeBridgeClient as realClient } from "./client";
function detectBrowserMode(): boolean {
@@ -106,41 +94,6 @@ function persistShimSelectedSource(source: ShimDesktopSource | null) {
}
})();
-const appearanceStorageKey = "browser-shim-project-appearance-v1";
-let shimAppearanceDefaults: ProjectAppearanceDefaults = DEFAULT_PROJECT_APPEARANCE;
-let shimHasCustomAppearance = false;
-(() => {
- try {
- const raw = localStorage.getItem(appearanceStorageKey);
- if (!raw) return;
- const parsed = JSON.parse(raw) as { version?: unknown; defaults?: unknown };
- if (parsed.version === 1 && parsed.defaults) {
- shimAppearanceDefaults = parseProjectAppearanceDefaults(parsed.defaults);
- shimHasCustomAppearance = true;
- }
- } catch {
- // Corrupt/unavailable localStorage starts from canonical factory appearance.
- }
-})();
-
-function shimAppSettingsSnapshot() {
- return {
- recording: shimRecordingPrefs,
- lastSource: shimSelectedSource
- ? describeRecordingSource(getPlatform(), {
- id: shimSelectedSource.id,
- name: shimSelectedSource.name,
- display_id: shimSelectedSource.display_id,
- })
- : null,
- appearance: {
- version: 1 as const,
- custom: shimHasCustomAppearance,
- defaults: shimAppearanceDefaults,
- },
- };
-}
-
// ponytail: real file dialogs/ffmpeg probing aren't available in a plain
// browser tab, but a hidden <input type="file"> + blob URL gets us a real,
// playable video without any native bridge — NewEditorShell/toFileUrl
@@ -235,39 +188,6 @@ function createShimElectronAPI() {
shimRecordingPrefsListeners.add(callback);
return () => shimRecordingPrefsListeners.delete(callback);
},
- getAppSettings: () => Promise.resolve(shimAppSettingsSnapshot()),
- setProjectAppearanceDefaults: (defaults: ProjectAppearanceDefaults) => {
- const next = parseProjectAppearanceDefaults(defaults);
- localStorage.setItem(appearanceStorageKey, JSON.stringify({ version: 1, defaults: next }));
- shimAppearanceDefaults = next;
- shimHasCustomAppearance = true;
- return Promise.resolve(shimAppSettingsSnapshot());
- },
- resetProjectAppearanceDefaults: () => {
- localStorage.setItem(appearanceStorageKey, JSON.stringify({ version: 1, defaults: null }));
- shimAppearanceDefaults = DEFAULT_PROJECT_APPEARANCE;
- shimHasCustomAppearance = false;
- return Promise.resolve(shimAppSettingsSnapshot());
- },
- resetRecordingSetup: () => {
- const next: ShimRecordingPrefs = {
- micEnabled: false,
- micDeviceId: null,
- micDeviceName: null,
- camEnabled: false,
- camDeviceId: null,
- camDeviceName: null,
- systemAudioEnabled: false,
- cursorCaptureMode: "editable-overlay",
- };
- localStorage.setItem(recordingPrefsStorageKey, JSON.stringify(next));
- shimRecordingPrefs = next;
- shimSelectedSource = null;
- persistShimSelectedSource(null);
- shimRecordingPrefsListeners.forEach((listener) => listener(next));
- shimSelectedSourceListeners.forEach((listener) => listener(null));
- return Promise.resolve(shimAppSettingsSnapshot());
- },
// ponytail: the chat panel subscribes to this on mount, unconditionally.
// Without a stub the whole editor tree throws before it paints, so every
// browser-shim test fails at boot, not just the chat ones. Nothing streams
@@ -506,10 +426,7 @@ function createShimBridgeClient() {
audioTracks: [],
legacyEditor: null,
};
- const doc = applyProjectAppearanceDefaults(
- empty as unknown as AxcutDocument,
- shimAppearanceDefaults,
- ) as unknown as ShimDocument;
+ const doc = empty as unknown as ShimDocument;
documentsByProject[doc.project.id] = doc;
projectOrder.unshift(doc.project.id);
saveProjectsState();
diff --git a/technical-documentation/testing/images/recording-defaults-reset-windows.png b/technical-documentation/testing/images/recording-defaults-reset-windows.png
deleted file mode 100644
index 0833302ac..000000000
Binary files a/technical-documentation/testing/images/recording-defaults-reset-windows.png and /dev/null differ
diff --git a/technical-documentation/testing/manual-e2e-checklist.md b/technical-documentation/testing/manual-e2e-checklist.md
index d298c5df1..0c4a4cdb4 100644
--- a/technical-documentation/testing/manual-e2e-checklist.md
+++ b/technical-documentation/testing/manual-e2e-checklist.md
@@ -623,7 +623,5 @@ The mask comes from the native compositor (ONNX Runtime + the vendored selfie-se
| | | | | |
| 2026-09-05 | Windows single-frame decoder ownership follow-up; source SHA-256 `FAF87561...87117`, bundled addon `94bc16d7...43a2c`, app.asar `8063a377...96f04` | Windows 11 build 26340; packaged Electron 41.2.1 | Scoped pass: nonzero AV1 seek and cross-clip playback | Fresh package, unique profile, no addon override; all 15 packaged native files hash-match staging (the existing packaging filter excludes standalone `ffmpeg.exe`). Native keyboard opened Studio after HUD pointer targeting failed; Studio seek/play/close used native input. AV1 at timeline 1.500 s/source 0.400 s rendered red `[255,24,0,255]` with a retained screenshot. During native playback from the first H.264 clip, read-only CDP samples observed blue followed by third-clip green `[0,216,0,255]` at 1.571 s; native logs confirm the malformed AV1 and following H.264 sources. PID 35472 exited 0 through window Close. An earlier sandboxed launch failed during Chromium GPU startup and is excluded from this pass. Limits: synthetic media, two native playback attempts in one successful session, no repeated stability or reporter-file claim; capture/webcam/tray/export not run. Exact-endpoint 4.540 s and one subsequent seek showed first-clip blue after native free-run wrapped: unchanged clip-identity synchronization paths, outside this resource/preflight follow-up; endpoint correctness is not claimed. Historical A/B rows remain separate. |
| 2026-09-11 | dev build (`npm run dev`) of `fix/582-antialias-decimation`, base `fbe461e9`, final commit `8d97f799`. The 96 and 192 kHz A/B ran the helper from a clean `npm run build:native:win` of the tree `8d97f799` carries; the 384 kHz A/B and the 48 kHz app run used helpers built with the same command from earlier revisions of this branch, whose helper sources differ from `8d97f799` only in comments and whitespace. The A/B's pre-fix helper was built from `fbe461e9` in a separate worktree. No binary hash is given; build from the commit SHA. | Windows 11 Pro 26340, 2560×1600 @ 150% (as read after the runs) | Scoped pass — no defect; the 96, 192 and 384 kHz (factors 2, 4 and 8) A/B ran and the alias is gone | **Anti-alias decimation (#582) slice.** **48 kHz path, in the app, with real OS input against the click-through HUD:** source picker → Entire screen → Share; system audio on (helper launched with `system: { enabled: true }`); record with countdown; **pause at 00:32** (timer yellow, control switches to resume) and **resume** (red at 00:36); stop → editor opens with the take; playback of the saved recording runs, playhead advancing through 0:04.6 and 0:11.6. Recorded stream `aac, 48000 Hz, 2 ch, 192000 bit/s`, 38.38 s. The endpoint ran at 48 kHz, so nothing decimated on this pass: the 1 kHz reference measured **-26.97 dBFS**, and the 4 kHz and 12 kHz alias bins were empty (-128 and -125 dBFS). The 20 kHz probe component is absent (-136 dBFS), and an AAC encode alone removes it too: the same tone encoded to AAC 192 kbps by ffmpeg, with no capture involved, reads -131 dBFS at 20 kHz against -13.99 dBFS at 1 kHz — so a 20 kHz probe cannot test the capture path. **Decimation path, A/B'd against the pre-fix build at three rates:** a USB DAC was made the default render endpoint and its *shared-mode* format set to 96000, 192000 and 384000 Hz in turn, so loopback reports that rate, the encoder target stays 48000, and the factor is 2, 4 and 8; the helper's own `audio-format` event confirmed the rate in every run. The helper was driven the way the app drives it (config JSON argument, `stop` on stdin), not through the app UI. Fold-bin readings, before → after, for 96 / 192 / 384 kHz: a 36 kHz tone (folds onto 12 kHz) **-22.25 → at most -115.32**, **-23.90 → at most -138.02**, **-24.28 → at most -111.54 dBFS**; a 42 kHz tone (folds onto 6 kHz) **-28.20 → at most -137.14**, **-30.40 → at most -135.09**, **-30.96 → at most -117.25 dBFS**. The after readings bound what the recordings hold and sit near each recording's floor; they are not the filter's leakage, which the design puts at -123 to -155 dBFS at these points. The 1 kHz reference reads -13.98 or -13.99 dBFS in every recording; each pre-fix recording shows its alias only in its own fold bin; every pre-fix reading matches the box average's frequency response to within 0.08 dB; the 384 kHz runs were repeated and agree to 0.01 dB. AAC track length is not used as evidence about the filter's delay or about frame accounting (tracks are whole 1024-sample AAC frames, and repeat runs of the same helper differ by up to six); that output frame counts do not drift is asserted by the helper's suite. Beyond these recordings the behaviour is covered by that suite (95 assertions, including a real-`AudioMixer` case) plus eleven mutation counter-proofs and a control that must stay green. **Check the Advanced tab's format list, and every endpoint, before concluding a machine cannot run this** — a device's current format is not its capability. **Not run:** microphone, webcam, tray menu, export, and every non-Windows platform. A/V sync was not eyeballed: against the output timeline this change puts a decimated stream 39 + 1/factor output frames late (0.81–0.82 ms at a 48 kHz output; the filter's own group delay is 40·factor source frames), below what watching can resolve, so it is asserted numerically in the suite instead. |
-| 2026-09-12 | dev build, `fix/509-hud-session-prefs` @ `fbe461e9` plus uncommitted issue-509 patch | Windows 11 | Partial — Settings persistence only | Playwright drove two separate real Electron processes against one isolated userData profile. Recording toggles/device identity and versioned new-project appearance survived a full process restart; a project created before restart and another created after restart both materialized the chosen appearance on their first write. One test passed. This is scripted CDP state/UI evidence and does not count as OS-input capture proof. Native computer-use was unavailable, so source picker interaction, physical microphone/camera, record→edit, missing-source UI behavior, reset through visible controls, tray, export, macOS and Linux were skipped. |
-| 2026-09-13 | source-built 1.11.0 integration, settings synchronization repair included | Windows 11, isolated profile | Partial — recording defaults pass | Real OS input verified recording preferences across restart, reset while RecStage remained mounted (previews stop and active source clears), factory defaults on new-project first write, unchanged existing projects and missing-source recovery. The test used the combined tree before PR splitting; it is not a second hardware pass on the split commit. See [recording-defaults-windows.md](recording-defaults-windows.md) for the screenshot, build context and exclusions. No STT, HUD pointer/tray, precise AV sync, other-platform or release-promotion claim. |
| 2026-09-13 | `6862a380` + microphone USB-label resolver patch; rebuilt release helpers | macOS 26.6.2, Apple Silicon, Shure MV7 | Partial | Real desktop HUD: selected explicit `Shure MV7 (14ed:1012)`, microphone on, system audio/camera off; started/stopped capture and reached saved editor (16.1 s). Logs confirm the rebuilt helper path and decorated label. Raw AAC is non-silent (mean -37.4 dBFS, peak -13.3 dBFS). Separately, the resolver matched the decorated label to the real AVFoundation MV7 ID. Default input was also MV7, so audio alone does not prove non-default routing. Listening, mixed/system audio, export, non-default-input recording and other platforms were not run; this is not full acceptance. |
diff --git a/technical-documentation/testing/recording-defaults-windows.md b/technical-documentation/testing/recording-defaults-windows.md
deleted file mode 100644
index 63260a862..000000000
--- a/technical-documentation/testing/recording-defaults-windows.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Recording defaults: Windows validation
-
-The settings implementation was tested on Windows 11 in a source-built OpenScreen 1.11.0 with an isolated profile on 2026-09-13. The tested integration included the settings changes and the GIF/workbench changes that were subsequently split into separate PRs. This record is not a claim that the split PR was run through a second complete hardware pass.
-
-- Screen, system audio, microphone, webcam and combined recording opened in the editor. Playback, seeking and trimming were exercised with real OS input.
-- Recording preferences survived a full process restart. An explicitly selected microphone was restored; the camera used the default device, so explicit camera-ID persistence is not claimed by this pass.
-- Reset recording setup, with the recording page already mounted, immediately turned system audio, microphone and camera off, stopped both device previews and cleared the active source. This retest followed the fix for stale recording-page state.
-- Resetting appearance defaults left six existing project files unchanged. A new project created through the UI used the factory wallpaper, shadow, padding, motion blur and cursor defaults on its first write.
-- A selected test window was closed before restarting the app. The recording page remained unselected after source validation rather than selecting a different window. The durable descriptor was retained for future matching.
-
-The screenshot shows the recording page after reset. No microphone/camera preview, device identity, private media or filesystem path is visible.
-
-![Recording page after resetting recording setup](images/recording-defaults-reset-windows.png)
-
-The final synchronization repair passed targeted Vitest tests for recording preferences, RecStage, browser-shim events and LaunchWindow, both application/test TypeScript checks, scoped Biome checks, i18n validation and `npm run build-vite`.
-
-Not covered: STT (helper absent), HUD pointer hit-testing, tray behavior, precise audiovisual synchronization, exhaustive editor operations, macOS/Linux hardware testing or release packaging. This is a scoped Windows result, not release promotion approval. Earlier failed attempts remain separate historical records.
diff --git a/tests/e2e/settings-defaults.spec.ts b/tests/e2e/settings-defaults.spec.ts
deleted file mode 100644
index 316e0dc2c..000000000
--- a/tests/e2e/settings-defaults.spec.ts
+++ /dev/null
@@ -1,118 +0,0 @@
-import { once } from "node:events";
-import fs from "node:fs";
-import os from "node:os";
-import path from "node:path";
-import { fileURLToPath } from "node:url";
-import { _electron as electron, expect, test } from "@playwright/test";
-import { DEFAULT_PROJECT_APPEARANCE } from "../../src/lib/projectDefaults";
-
-const ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), "../..");
-const MAIN_JS = path.join(ROOT, "dist-electron/main.js");
-type ElectronApplication = Awaited<ReturnType<typeof electron.launch>>;
-type ProjectResult = {
- success: boolean;
- document: { project: { id: string }; legacyEditor: Record<string, unknown> };
-};
-
-async function launch(userData: string, temp: string) {
- return electron.launch({
- args: [
- MAIN_JS,
- "--no-sandbox",
- "--enable-unsafe-swiftshader",
- "--lang=en-US",
- `--user-data-dir=${userData}`,
- ],
- env: {
- ...process.env,
- ELECTRON_USER_DATA_DIR: userData,
- TMPDIR: temp,
- TMP: temp,
- TEMP: temp,
- HEADLESS: process.env["HEADLESS"] ?? "true",
- },
- });
-}
-
-async function close(app: ElectronApplication) {
- const process = app.process();
- await Promise.race([app.close(), new Promise<void>((resolve) => setTimeout(resolve, 5_000))]);
- if (process.exitCode === null && process.signalCode === null) {
- process.kill("SIGKILL");
- await Promise.race([
- once(process, "close"),
- new Promise<void>((resolve) => setTimeout(resolve, 5_000)),
- ]);
- }
-}
-
-test("recording setup and new-project appearance survive a real Electron restart", async () => {
- const userData = fs.mkdtempSync(path.join(os.tmpdir(), "openscreen-settings-e2e-"));
- const temp = fs.mkdtempSync(path.join(os.tmpdir(), "openscreen-settings-e2e-tmp-"));
- let app: ElectronApplication | null = null;
- try {
- app = await launch(userData, temp);
- const firstWindow = await app.firstWindow({ timeout: 60_000 });
- const custom = { ...DEFAULT_PROJECT_APPEARANCE, wallpaper: "#123456", padding: 17 };
- await firstWindow.evaluate(async (defaults) => {
- await window.electronAPI.setRecordingPrefs({
- micEnabled: true,
- micDeviceId: "persisted-mic",
- micDeviceName: "Persisted microphone",
- systemAudioEnabled: true,
- });
- await window.electronAPI.setProjectAppearanceDefaults(defaults);
- }, custom);
- const existing = await firstWindow.evaluate(() =>
- window.electronAPI.invokeNativeBridge<ProjectResult>({
- domain: "aiEdition",
- action: "document.create",
- payload: { title: "Before restart" },
- }),
- );
- expect(existing.ok).toBe(true);
- if (!existing.ok) throw new Error(existing.error.message);
- const existingId = existing.data?.document.project.id;
- expect(existing.data?.document.legacyEditor).toMatchObject({
- wallpaper: "#123456",
- padding: 17,
- });
- await close(app);
- app = null;
-
- app = await launch(userData, temp);
- const restartedWindow = await app.firstWindow({ timeout: 60_000 });
- const restored = await restartedWindow.evaluate(() => window.electronAPI.getAppSettings());
- expect(restored.recording).toMatchObject({
- micEnabled: true,
- micDeviceId: "persisted-mic",
- micDeviceName: "Persisted microphone",
- systemAudioEnabled: true,
- });
- expect(restored.appearance).toMatchObject({ custom: true, defaults: custom });
-
- const after = await restartedWindow.evaluate(async (oldId) => {
- const oldProject = await window.electronAPI.invokeNativeBridge<ProjectResult>({
- domain: "aiEdition",
- action: "document.get",
- payload: { projectId: oldId },
- });
- const fresh = await window.electronAPI.invokeNativeBridge<ProjectResult>({
- domain: "aiEdition",
- action: "document.create",
- payload: { title: "After restart" },
- });
- return { oldProject, fresh };
- }, existingId);
- expect(after.oldProject.ok).toBe(true);
- expect(after.fresh.ok).toBe(true);
- if (!after.oldProject.ok) throw new Error(after.oldProject.error.message);
- if (!after.fresh.ok) throw new Error(after.fresh.error.message);
- expect(after.oldProject.data.document.legacyEditor).toMatchObject({ padding: 17 });
- expect(after.fresh.data.document.legacyEditor).toMatchObject({ padding: 17 });
- } finally {
- if (app) await close(app);
- for (const directory of [userData, temp])
- fs.rmSync(directory, { recursive: true, force: true });
- }
-});