Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
refactor(desktop): update camera mutation to support skip_camera_window parameter
Richie McIlroy25689d212bab
diff --git a/apps/desktop/src/routes/in-progress-recording.tsx b/apps/desktop/src/routes/in-progress-recording.tsxindex 7ba70cafd..97fd9d87a 100644--- a/apps/desktop/src/routes/in-progress-recording.tsx+++ b/apps/desktop/src/routes/in-progress-recording.tsx@@ -397,7 +397,7 @@ function InProgressRecordingInner() {const previous = cloneDeviceOrModelId(selected);optionsQuery.setOptions("cameraID", next);try {- await commands.setCameraInput(next);+ await commands.setCameraInput(next, null);if (!next && cameraWindowOpen()) {const cameraWindow = await WebviewWindow.getByLabel("camera");if (cameraWindow) await cameraWindow.close();diff --git a/apps/desktop/src/utils/queries.ts b/apps/desktop/src/utils/queries.tsindex b5fa42e25..38b803e28 100644--- a/apps/desktop/src/utils/queries.ts+++ b/apps/desktop/src/utils/queries.ts@@ -249,33 +249,45 @@ export function createLicenseQuery() {export function createCameraMutation() {const { setOptions, rawOptions } = useRecordingOptions();- const rawMutate = async (model: DeviceOrModelID | null) => {+ const rawMutate = async (+ model: DeviceOrModelID | null,+ skipCameraWindow?: boolean,+ ) => {const before = rawOptions.cameraID ? { ...rawOptions.cameraID } : null;setOptions("cameraID", reconcile(model));- await commands.setCameraInput(model).catch(async (e) => {- const message =- typeof e === "string" ? e : e instanceof Error ? e.message : String(e);-- if (message.includes("DeviceNotFound")) {- setOptions("cameraID", null);- console.warn("Selected camera is unavailable.");- return;- }-- if (JSON.stringify(before) === JSON.stringify(model) || !before) {- setOptions("cameraID", null);- } else setOptions("cameraID", reconcile(before));-- throw e;- });-- if (model) {+ await commands+ .setCameraInput(model, skipCameraWindow ?? null)+ .catch(async (e) => {+ const message =+ typeof e === "string"+ ? e+ : e instanceof Error+ ? e.message+ : String(e);++ if (message.includes("DeviceNotFound")) {+ setOptions("cameraID", null);+ console.warn("Selected camera is unavailable.");+ return;+ }++ if (JSON.stringify(before) === JSON.stringify(model) || !before) {+ setOptions("cameraID", null);+ } else setOptions("cameraID", reconcile(before));++ throw e;+ });++ if (model && !skipCameraWindow) {getCurrentWindow().setFocus();}};const setCameraInput = useMutation(() => ({- mutationFn: rawMutate,+ mutationFn: (args: {+ model: DeviceOrModelID | null;+ skipCameraWindow?: boolean;+ }) => rawMutate(args.model, args.skipCameraWindow),}));return new Proxy(diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.tsindex 48f5dfcca..52334f0fc 100644--- a/apps/desktop/src/utils/tauri.ts+++ b/apps/desktop/src/utils/tauri.ts@@ -8,8 +8,8 @@ export const commands = {async setMicInput(label: string | null) : Promise<null> {return await TAURI_INVOKE("set_mic_input", { label });},-async setCameraInput(id: DeviceOrModelID | null) : Promise<null> {- return await TAURI_INVOKE("set_camera_input", { id });+async setCameraInput(id: DeviceOrModelID | null, skipCameraWindow: boolean | null) : Promise<null> {+ return await TAURI_INVOKE("set_camera_input", { id, skipCameraWindow });},async setRecordingMode(mode: RecordingMode) : Promise<null> {return await TAURI_INVOKE("set_recording_mode", { mode });