Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(editor): choose the recordings folder in Record mode
EtienneLescotc6db5bc2e5f3
diff --git a/src/components/ai-edition/v4/RecStage.test.tsx b/src/components/ai-edition/v4/RecStage.test.tsxindex 7ba2d33c3..49230e278 100644--- a/src/components/ai-edition/v4/RecStage.test.tsx+++ b/src/components/ai-edition/v4/RecStage.test.tsx@@ -77,6 +77,8 @@ vi.mock("@/hooks/usePortalOwnsSource", () => ({type RecordingPrefs = Awaited<ReturnType<Window["electronAPI"]["getRecordingPrefs"]>>;type SelectedSource = Awaited<ReturnType<Window["electronAPI"]["getSelectedSource"]>>;+type FolderChoice = Awaited<ReturnType<Window["electronAPI"]["chooseRecordingsDir"]>>;+type FolderReset = Awaited<ReturnType<Window["electronAPI"]["resetRecordingsDir"]>>;let recordingPrefsListeners: Array<(prefs: RecordingPrefs) => void> = [];let selectedSourceListeners: Array<(source: SelectedSource) => void> = [];@@ -666,6 +668,76 @@ describe("RecStage controls", () => {expect(recordingPrefsListeners).toEqual([]);expect(selectedSourceListeners).toEqual([]);});++ describe("recordings folder", () => {+ const DEFAULT_DIR = "C:\\Users\\me\\AppData\\Roaming\\openscreen\\recordings";+ const CUSTOM_DIR = "D:\\Takes";++ function stubRecordingsDir(initial: { path: string; isDefault: boolean }) {+ stubRecordingPrefs({ micEnabled: false });+ let current = initial;+ const api = {+ getRecordingsDir: vi.fn(async () => current),+ chooseRecordingsDir: vi.fn(async (): Promise<FolderChoice> => {+ current = { path: CUSTOM_DIR, isDefault: false };+ return { success: true, path: CUSTOM_DIR };+ }),+ resetRecordingsDir: vi.fn(async (): Promise<FolderReset> => {+ current = { path: DEFAULT_DIR, isDefault: true };+ return { success: true, path: DEFAULT_DIR };+ }),+ };+ Object.assign(window.electronAPI as object, api);+ return api;+ }++ it("names the folder, with its full path on hover, and offers no reset on the default", async () => {+ stubRecordingsDir({ path: DEFAULT_DIR, isDefault: true });+ renderRecStage();++ const button = await screen.findByRole("button", { name: "recordings" });+ expect(button).toHaveAttribute("title", DEFAULT_DIR);+ expect(screen.queryByRole("button", { name: "rec.resetRecordingsFolder" })).toBeNull();+ });++ it("switches to the folder picked in the native picker, then back to the default", async () => {+ const api = stubRecordingsDir({ path: DEFAULT_DIR, isDefault: true });+ renderRecStage();++ fireEvent.click(await screen.findByRole("button", { name: "recordings" }));+ const picked = await screen.findByRole("button", { name: "Takes" });+ expect(api.chooseRecordingsDir).toHaveBeenCalledOnce();+ expect(picked).toHaveAttribute("title", CUSTOM_DIR);++ fireEvent.click(screen.getByRole("button", { name: "rec.resetRecordingsFolder" }));+ await screen.findByRole("button", { name: "recordings" });+ expect(api.resetRecordingsDir).toHaveBeenCalledOnce();+ expect(screen.queryByRole("button", { name: "rec.resetRecordingsFolder" })).toBeNull();+ });++ it("says nothing when the picker is cancelled, and says so when the switch fails", async () => {+ const api = stubRecordingsDir({ path: CUSTOM_DIR, isDefault: false });+ api.chooseRecordingsDir.mockResolvedValueOnce({ success: false, canceled: true });+ api.resetRecordingsDir.mockResolvedValueOnce({ success: false });+ renderRecStage();++ fireEvent.click(await screen.findByRole("button", { name: "Takes" }));+ await waitFor(() => expect(api.chooseRecordingsDir).toHaveBeenCalled());+ expect(toast.error).not.toHaveBeenCalled();++ fireEvent.click(screen.getByRole("button", { name: "rec.resetRecordingsFolder" }));+ await waitFor(() => expect(toast.error).toHaveBeenCalledWith("rec.recordingsFolderFailed"));+ expect(screen.getByRole("button", { name: "Takes" })).toBeInTheDocument();+ });++ it("leaves the row out when there is no main process to ask", async () => {+ stubRecordingPrefs({ micEnabled: false });+ renderRecStage();++ await screen.findByText("rec.systemAudio");+ expect(screen.queryByText("rec.recordingsFolder")).toBeNull();+ });+ });});describe("RecStage names and tooltips", () => {diff --git a/src/components/ai-edition/v4/RecStage.tsx b/src/components/ai-edition/v4/RecStage.tsxindex 9a87698f8..5c231f798 100644--- a/src/components/ai-edition/v4/RecStage.tsx+++ b/src/components/ai-edition/v4/RecStage.tsx@@ -2,6 +2,7 @@ import {Camera,CameraOff,ChevronDown,+ FolderOpen,LayoutGrid,Loader2,MicOff,@@ -13,6 +14,7 @@ import {ZoomIn,} from "lucide-react";import { useEffect, useId, useRef, useState } from "react";+import { toast } from "sonner";import { AudioLevelMeter } from "@/components/ui/audio-level-meter";import { Tooltip } from "@/components/ui/tooltip";import { useScopedT } from "@/contexts/I18nContext";@@ -53,6 +55,11 @@ const DEFAULT_PREFS: RecordingPrefsState = {autoZoomEnabled: true,};+/** The last segment of a Windows or POSIX path; a drive root keeps its letter. */+function folderName(folderPath: string): string {+ return folderPath.split(/[\\/]/).filter(Boolean).pop() ?? folderPath;+}+function normalizedRecordingPrefs(prefs: Partial<RecordingPrefsState>): RecordingPrefsState {const next = { ...DEFAULT_PREFS, ...prefs };// A saved microphone is not applied where a take cannot record it (#700): no@@ -285,6 +292,45 @@ export function RecStage({setSource(result ?? null);setSourceModalOpen(false);};+ // ── recordings folder ───────────────────────────────────────────+ // Unknown without a main process to ask (browser mode): the row is then left out.+ const [recordingsDir, setRecordingsDir] = useState<{ path: string; isDefault: boolean } | null>(+ null,+ );+ useEffect(() => {+ let cancelled = false;+ void window.electronAPI+ ?.getRecordingsDir?.()+ .then((info) => {+ if (!cancelled && info) setRecordingsDir(info);+ })+ .catch((err) => {+ console.warn("[rec-stage] failed to read the recordings folder:", err);+ });+ return () => {+ cancelled = true;+ };+ }, []);+ const [changingRecordingsDir, setChangingRecordingsDir] = useState(false);+ const changeRecordingsDir = async (+ change: () => Promise<{ success: boolean; canceled?: boolean }>,+ ) => {+ setChangingRecordingsDir(true);+ try {+ const result = await change();+ if (result.success) {+ setRecordingsDir(await window.electronAPI.getRecordingsDir());+ } else if (!result.canceled) {+ toast.error(t("rec.recordingsFolderFailed"));+ }+ } catch (err) {+ console.warn("[rec-stage] failed to change the recordings folder:", err);+ toast.error(t("rec.recordingsFolderFailed"));+ } finally {+ setChangingRecordingsDir(false);+ }+ };+const screenSources = sources.filter((s) => s.id.startsWith("screen:"));const windowSources = sources.filter((s) => s.id.startsWith("window:"));const visibleSources = sourceTab === "screen" ? screenSources : windowSources;@@ -587,6 +633,43 @@ export function RecStage({</Tooltip></div>) : null}++ {recordingsDir ? (+ <div className={styles.recRow}>+ <div className={styles.recRowLabel}>+ <FolderOpen size={15} />+ {t("rec.recordingsFolder")}+ </div>+ <div className={styles.recRowControl}>+ {/* The folder's own name, which is what tells two folders apart; the+ full path is one hover away. */}+ <button+ type="button"+ className={styles.recRowSourceBtn}+ title={recordingsDir.path}+ disabled={changingRecordingsDir}+ onClick={() =>+ void changeRecordingsDir(() => window.electronAPI.chooseRecordingsDir())+ }+ >+ <span>{folderName(recordingsDir.path)}</span>+ <ChevronDown size={13} style={{ opacity: 0.6 }} />+ </button>+ {recordingsDir.isDefault ? null : (+ <button+ type="button"+ className={styles.recToggleBtn}+ disabled={changingRecordingsDir}+ onClick={() =>+ void changeRecordingsDir(() => window.electronAPI.resetRecordingsDir())+ }+ >+ {t("rec.resetRecordingsFolder")}+ </button>+ )}+ </div>+ </div>+ ) : null}</div></div>diff --git a/src/i18n/locales/ar/editor.json b/src/i18n/locales/ar/editor.jsonindex e59e30724..e9b49f50c 100644--- a/src/i18n/locales/ar/editor.json+++ b/src/i18n/locales/ar/editor.json@@ -141,7 +141,10 @@"noScreensFound": "لم يتم العثور على شاشات","noWindowsFound": "لم يتم العثور على نوافذ","cancel": "إلغاء"- }+ },+ "recordingsFolder": "مجلد التسجيلات",+ "resetRecordingsFolder": "إعادة التعيين إلى الافتراضي",+ "recordingsFolderFailed": "تعذّر التبديل إلى هذا المجلد"},"mediaStage": {"openProjectFirst": "افتح مشروعًا أولاً",diff --git a/src/i18n/locales/cs/editor.json b/src/i18n/locales/cs/editor.jsonindex 2ee3f9908..de54b4752 100644--- a/src/i18n/locales/cs/editor.json+++ b/src/i18n/locales/cs/editor.json@@ -141,7 +141,10 @@"noScreensFound": "Žádné obrazovky nenalezeny","noWindowsFound": "Žádná okna nenalezena","cancel": "Zrušit"- }+ },+ "recordingsFolder": "Složka pro nahrávky",+ "resetRecordingsFolder": "Obnovit výchozí",+ "recordingsFolderFailed": "Přepnutí do této složky se nezdařilo"},"mediaStage": {"openProjectFirst": "Nejprve otevřete projekt",diff --git a/src/i18n/locales/de/editor.json b/src/i18n/locales/de/editor.jsonindex d4169cfe0..a0a6af26c 100644--- a/src/i18n/locales/de/editor.json+++ b/src/i18n/locales/de/editor.json@@ -141,7 +141,10 @@"noScreensFound": "Keine Bildschirme gefunden","noWindowsFound": "Keine Fenster gefunden","cancel": "Abbrechen"- }+ },+ "recordingsFolder": "Ordner für Aufnahmen",+ "resetRecordingsFolder": "Auf Standard zurücksetzen",+ "recordingsFolderFailed": "Wechsel zu diesem Ordner fehlgeschlagen"},"mediaStage": {"openProjectFirst": "Öffne zuerst ein Projekt",diff --git a/src/i18n/locales/en/editor.json b/src/i18n/locales/en/editor.jsonindex 1b701cc3c..233e668be 100644--- a/src/i18n/locales/en/editor.json+++ b/src/i18n/locales/en/editor.json@@ -141,7 +141,10 @@"noScreensFound": "No screens found","noWindowsFound": "No windows found","cancel": "Cancel"- }+ },+ "recordingsFolder": "Recordings folder",+ "resetRecordingsFolder": "Reset to default",+ "recordingsFolderFailed": "Couldn't switch to that folder"},"mediaStage": {"openProjectFirst": "Open a project first",diff --git a/src/i18n/locales/es/editor.json b/src/i18n/locales/es/editor.jsonindex c35a1113e..618a3e77c 100644--- a/src/i18n/locales/es/editor.json+++ b/src/i18n/locales/es/editor.json@@ -141,7 +141,10 @@"noScreensFound": "No se encontraron pantallas","noWindowsFound": "No se encontraron ventanas","cancel": "Cancelar"- }+ },+ "recordingsFolder": "Carpeta de grabaciones",+ "resetRecordingsFolder": "Restablecer valor predeterminado",+ "recordingsFolderFailed": "No se pudo cambiar a esa carpeta"},"mediaStage": {"openProjectFirst": "Abre un proyecto primero",diff --git a/src/i18n/locales/fr/editor.json b/src/i18n/locales/fr/editor.jsonindex c711cda8e..a7732bcd6 100644--- a/src/i18n/locales/fr/editor.json+++ b/src/i18n/locales/fr/editor.json@@ -141,7 +141,10 @@"noScreensFound": "Aucun écran trouvé","noWindowsFound": "Aucune fenêtre trouvée","cancel": "Annuler"- }+ },+ "recordingsFolder": "Dossier des enregistrements",+ "resetRecordingsFolder": "Réinitialiser par défaut",+ "recordingsFolderFailed": "Impossible de passer à ce dossier"},"mediaStage": {"openProjectFirst": "Ouvrez d'abord un projet",diff --git a/src/i18n/locales/it/editor.json b/src/i18n/locales/it/editor.jsonindex 859fcbefc..59cd509dd 100644--- a/src/i18n/locales/it/editor.json+++ b/src/i18n/locales/it/editor.json@@ -141,7 +141,10 @@"noScreensFound": "Nessuno schermo trovato","noWindowsFound": "Nessuna finestra trovata","cancel": "Annulla"- }+ },+ "recordingsFolder": "Cartella registrazioni",+ "resetRecordingsFolder": "Ripristina predefinito",+ "recordingsFolderFailed": "Impossibile passare a quella cartella"},"mediaStage": {"openProjectFirst": "Apri prima un progetto",diff --git a/src/i18n/locales/ja-JP/editor.json b/src/i18n/locales/ja-JP/editor.jsonindex 23b7a398b..dfc86e745 100644--- a/src/i18n/locales/ja-JP/editor.json+++ b/src/i18n/locales/ja-JP/editor.json@@ -141,7 +141,10 @@"noScreensFound": "画面が見つかりません","noWindowsFound": "ウィンドウが見つかりません","cancel": "キャンセル"- }+ },+ "recordingsFolder": "録画フォルダー",+ "resetRecordingsFolder": "デフォルトに戻す",+ "recordingsFolderFailed": "そのフォルダーに切り替えられませんでした"},"mediaStage": {"openProjectFirst": "先にプロジェクトを開いてください",diff --git a/src/i18n/locales/ko-KR/editor.json b/src/i18n/locales/ko-KR/editor.jsonindex e4d5a42c0..ccc5465c3 100644--- a/src/i18n/locales/ko-KR/editor.json+++ b/src/i18n/locales/ko-KR/editor.json@@ -141,7 +141,10 @@"noScreensFound": "화면을 찾을 수 없음","noWindowsFound": "창을 찾을 수 없음","cancel": "취소"- }+ },+ "recordingsFolder": "녹화 폴더",+ "resetRecordingsFolder": "기본값으로 재설정",+ "recordingsFolderFailed": "해당 폴더로 전환하지 못했습니다"},"mediaStage": {"openProjectFirst": "먼저 프로젝트를 여세요",diff --git a/src/i18n/locales/pt-BR/editor.json b/src/i18n/locales/pt-BR/editor.jsonindex 4a687b8d2..c7a46f550 100644--- a/src/i18n/locales/pt-BR/editor.json+++ b/src/i18n/locales/pt-BR/editor.json@@ -141,7 +141,10 @@"noScreensFound": "Nenhuma tela encontrada","noWindowsFound": "Nenhuma janela encontrada","cancel": "Cancelar"- }+ },+ "recordingsFolder": "Pasta de gravações",+ "resetRecordingsFolder": "Redefinir para o padrão",+ "recordingsFolderFailed": "Não foi possível mudar para essa pasta"},"mediaStage": {"openProjectFirst": "Abra um projeto primeiro",diff --git a/src/i18n/locales/ru/editor.json b/src/i18n/locales/ru/editor.jsonindex 37aa8bea8..b83d5905b 100644--- a/src/i18n/locales/ru/editor.json+++ b/src/i18n/locales/ru/editor.json@@ -141,7 +141,10 @@"noScreensFound": "Экраны не найдены","noWindowsFound": "Окна не найдены","cancel": "Отмена"- }+ },+ "recordingsFolder": "Папка для записей",+ "resetRecordingsFolder": "Сбросить по умолчанию",+ "recordingsFolderFailed": "Не удалось переключиться на эту папку"},"mediaStage": {"openProjectFirst": "Сначала откройте проект",diff --git a/src/i18n/locales/tr/editor.json b/src/i18n/locales/tr/editor.jsonindex 37be9dab2..06dda4836 100644--- a/src/i18n/locales/tr/editor.json+++ b/src/i18n/locales/tr/editor.json@@ -141,7 +141,10 @@"noScreensFound": "Ekran bulunamadı","noWindowsFound": "Pencere bulunamadı","cancel": "İptal"- }+ },+ "recordingsFolder": "Kayıt klasörü",+ "resetRecordingsFolder": "Varsayılana sıfırla",+ "recordingsFolderFailed": "O klasöre geçilemedi"},"mediaStage": {"openProjectFirst": "Önce bir proje açın",diff --git a/src/i18n/locales/vi/editor.json b/src/i18n/locales/vi/editor.jsonindex 53c9e98ee..b3ef870eb 100644--- a/src/i18n/locales/vi/editor.json+++ b/src/i18n/locales/vi/editor.json@@ -141,7 +141,10 @@"noScreensFound": "Không tìm thấy màn hình","noWindowsFound": "Không tìm thấy cửa sổ","cancel": "Hủy"- }+ },+ "recordingsFolder": "Thư mục bản ghi",+ "resetRecordingsFolder": "Đặt lại về mặc định",+ "recordingsFolderFailed": "Không thể chuyển sang thư mục đó"},"mediaStage": {"openProjectFirst": "Hãy mở một dự án trước",diff --git a/src/i18n/locales/zh-CN/editor.json b/src/i18n/locales/zh-CN/editor.jsonindex 7febf6b15..7bf8f7ae7 100644--- a/src/i18n/locales/zh-CN/editor.json+++ b/src/i18n/locales/zh-CN/editor.json@@ -141,7 +141,10 @@"noScreensFound": "未找到屏幕","noWindowsFound": "未找到窗口","cancel": "取消"- }+ },+ "recordingsFolder": "录制文件夹",+ "resetRecordingsFolder": "恢复默认设置",+ "recordingsFolderFailed": "无法切换到该文件夹"},"mediaStage": {"openProjectFirst": "请先打开一个项目",diff --git a/src/i18n/locales/zh-TW/editor.json b/src/i18n/locales/zh-TW/editor.jsonindex 5336783b5..5c9b56a2d 100644--- a/src/i18n/locales/zh-TW/editor.json+++ b/src/i18n/locales/zh-TW/editor.json@@ -141,7 +141,10 @@"noScreensFound": "找不到螢幕","noWindowsFound": "找不到視窗","cancel": "取消"- }+ },+ "recordingsFolder": "錄製資料夾",+ "resetRecordingsFolder": "重設為預設值",+ "recordingsFolderFailed": "無法切換到該資料夾"},"mediaStage": {"openProjectFirst": "請先開啟專案",