Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Add recording store defaults
Richie McIlroyb3147b07805a
diff --git a/apps/desktop/src/store.ts b/apps/desktop/src/store.tsindex d2f3b29a6..27cc4216b 100644--- a/apps/desktop/src/store.ts+++ b/apps/desktop/src/store.ts@@ -18,10 +18,17 @@ const store = () => {return _store;};-function declareStore<T extends object>(name: string) {- const get = () => store().then((s) => s.get<T>(name));+function declareStore<T extends object>(name: string, defaults?: T) {+ const withDefaults = (value?: T) =>+ defaults ? { ...defaults, ...(value ?? {}) } : value;+ const get = async () => {+ const s = await store();+ return withDefaults(await s.get<T>(name));+ };const listen = (fn: (data?: T | undefined) => void) =>- store().then((s) => s.onKeyChange<T>(name, fn));+ store().then((s) =>+ s.onKeyChange<T>(name, (data) => fn(withDefaults(data))),+ );return {get,@@ -59,5 +66,16 @@ export const authStore = declareStore<AuthStore>("auth");export const hotkeysStore = declareStore<HotkeysStore>("hotkeys");export const generalSettingsStore =declareStore<GeneralSettingsStore>("general_settings");-export const recordingSettingsStore =- declareStore<RecordingSettingsStore>("recording_settings");+export const recordingSettingsStore = declareStore<RecordingSettingsStore>(+ "recording_settings",+ {+ target: null,+ micName: null,+ cameraId: null,+ mode: "instant",+ systemAudio: false,+ organizationId: null,+ cameraDeviceSettings: {},+ microphoneDeviceSettings: {},+ },+);diff --git a/crates/recording/src/lib.rs b/crates/recording/src/lib.rsindex 12c87e5c6..fec0535dc 100644--- a/crates/recording/src/lib.rs+++ b/crates/recording/src/lib.rs@@ -37,8 +37,8 @@ use crate::{feeds::camera::CameraFeedLock, sources::screen_capture::ScreenCaptur#[derive(specta::Type, Serialize, Deserialize, Clone, Debug, Copy, Default, PartialEq, Eq)]#[serde(rename_all = "camelCase")]pub enum RecordingMode {- #[default]Studio,+ #[default]Instant,Screenshot,}