Skip to content

Commit 8118a0c

Browse files
authored
Merge branch 'main' into adjust-zoom-speed
2 parents 0cb298d + e7d5f51 commit 8118a0c

49 files changed

Lines changed: 3383 additions & 377 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ jobs:
3131
- run: npm ci
3232
- run: npx tsc --noEmit
3333

34+
test:
35+
name: Test
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version: 22
42+
cache: npm
43+
- run: npm ci
44+
- run: npm run test:browser:install
45+
- run: npm run test:browser
46+
3447
build:
3548
name: Build
3649
runs-on: ubuntu-latest

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ release/**
2929

3030
# Playwright
3131
test-results
32-
playwright-report/
32+
playwright-report/
33+
34+
# Vitest browser mode screenshots
35+
__screenshots__/

electron/electron-env.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ interface Window {
2626
electronAPI: {
2727
getSources: (opts: Electron.SourcesOptions) => Promise<ProcessedDesktopSource[]>;
2828
switchToEditor: () => Promise<void>;
29+
switchToHud: () => Promise<void>;
30+
startNewRecording: () => Promise<{ success: boolean; error?: string }>;
2931
openSourceSelector: () => Promise<void>;
3032
selectSource: (source: ProcessedDesktopSource) => Promise<ProcessedDesktopSource | null>;
3133
getSelectedSource: () => Promise<ProcessedDesktopSource | null>;

electron/i18n.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,26 @@ import commonEn from "../src/i18n/locales/en/common.json";
55
import dialogsEn from "../src/i18n/locales/en/dialogs.json";
66
import commonEs from "../src/i18n/locales/es/common.json";
77
import dialogsEs from "../src/i18n/locales/es/dialogs.json";
8+
import commonFr from "../src/i18n/locales/fr/common.json";
9+
import dialogsFr from "../src/i18n/locales/fr/dialogs.json";
810
import commonZh from "../src/i18n/locales/zh-CN/common.json";
911
import dialogsZh from "../src/i18n/locales/zh-CN/dialogs.json";
1012

11-
type Locale = "en" | "zh-CN" | "es";
13+
type Locale = "en" | "zh-CN" | "es" | "fr";
1214
type Namespace = "common" | "dialogs";
1315
type MessageMap = Record<string, unknown>;
1416

1517
const messages: Record<Locale, Record<Namespace, MessageMap>> = {
1618
en: { common: commonEn, dialogs: dialogsEn },
1719
"zh-CN": { common: commonZh, dialogs: dialogsZh },
1820
es: { common: commonEs, dialogs: dialogsEs },
21+
fr: { common: commonFr, dialogs: dialogsFr },
1922
};
2023

2124
let currentLocale: Locale = "en";
2225

2326
export function setMainLocale(locale: string) {
24-
if (locale === "en" || locale === "zh-CN" || locale === "es") {
27+
if (locale === "en" || locale === "zh-CN" || locale === "es" || locale === "fr") {
2528
currentLocale = locale;
2629
}
2730
}

electron/ipc/handlers.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,24 @@ export function registerIpcHandlers(
355355
getMainWindow: () => BrowserWindow | null,
356356
getSourceSelectorWindow: () => BrowserWindow | null,
357357
onRecordingStateChange?: (recording: boolean, sourceName: string) => void,
358+
switchToHud?: () => void,
358359
) {
360+
ipcMain.handle("switch-to-hud", () => {
361+
if (switchToHud) switchToHud();
362+
});
363+
ipcMain.handle("start-new-recording", async () => {
364+
try {
365+
setCurrentRecordingSessionState(null);
366+
if (switchToHud) {
367+
switchToHud();
368+
}
369+
return { success: true };
370+
} catch (error) {
371+
console.error("Failed to start new recording:", error);
372+
return { success: false, error: String(error) };
373+
}
374+
});
375+
359376
ipcMain.handle("get-sources", async (_, opts) => {
360377
const sources = await desktopCapturer.getSources(opts);
361378
return sources.map((source) => ({

electron/main.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,16 @@ app.whenReady().then(async () => {
371371
// Ensure recordings directory exists
372372
await ensureRecordingsDir();
373373

374+
function switchToHudWrapper() {
375+
if (mainWindow) {
376+
isForceClosing = true;
377+
mainWindow.close();
378+
isForceClosing = false;
379+
mainWindow = null;
380+
}
381+
showMainWindow();
382+
}
383+
374384
registerIpcHandlers(
375385
createEditorWindowWrapper,
376386
createSourceSelectorWindowWrapper,
@@ -384,6 +394,7 @@ app.whenReady().then(async () => {
384394
showMainWindow();
385395
}
386396
},
397+
switchToHudWrapper,
387398
);
388399
createWindow();
389400
});

electron/preload.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ contextBridge.exposeInMainWorld("electronAPI", {
1818
switchToEditor: () => {
1919
return ipcRenderer.invoke("switch-to-editor");
2020
},
21+
switchToHud: () => {
22+
return ipcRenderer.invoke("switch-to-hud");
23+
},
24+
startNewRecording: () => {
25+
return ipcRenderer.invoke("start-new-recording");
26+
},
2127
openSourceSelector: () => {
2228
return ipcRenderer.invoke("open-source-selector");
2329
},

0 commit comments

Comments
 (0)