Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Persist system audio and lock GPUI updater
Richie McIlroy3554ce258e57
diff --git a/apps/desktop-gpui/packaging/windows/installer-hooks.nsh b/apps/desktop-gpui/packaging/windows/installer-hooks.nshindex 6ef08c2eb..dde6107ad 100644--- a/apps/desktop-gpui/packaging/windows/installer-hooks.nsh+++ b/apps/desktop-gpui/packaging/windows/installer-hooks.nsh@@ -3,6 +3,13 @@; Cap.exe, which share most of their code; the default 8 MB window cannot.SetCompressorDictSize 128+; Cap 0.6.0 ran its GPUI app as cap-gpui.exe next to Cap.exe. The template+; only closes Cap.exe before copying files, so a running cap-gpui.exe would keep+; the shared FFmpeg DLLs locked and stop the update with a file-in-use error.+!macro NSIS_HOOK_PREINSTALL+ !insertmacro CheckIfAppIsRunning "cap-gpui.exe" "${PRODUCTNAME}"+!macroend+!macro NSIS_HOOK_POSTINSTALLDelete "$INSTDIR\cap-gpui.exe"Delete "$INSTDIR\cap-exporter.exe"diff --git a/apps/desktop-gpui/src/main_window.rs b/apps/desktop-gpui/src/main_window.rsindex da6737d94..d4f7843af 100644--- a/apps/desktop-gpui/src/main_window.rs+++ b/apps/desktop-gpui/src/main_window.rs@@ -1005,7 +1005,7 @@ impl MainWindow {device_format_generation: 0,device_format_pending: None,device_format_notice: None,- system_audio: false,+ system_audio: crate::store::recording_system_audio(),selected_display: None,selected_window: None,panel: None,@@ -2556,10 +2556,14 @@ impl MainWindow {cx.notify();}- /// Toggle system audio capture -- the system-audio row is a plain flag.+ /// Toggle system audio capture -- the system-audio row is a plain flag,+ /// persisted as `recording_settings.systemAudio` like the Tauri app did.pub fn set_system_audio(&mut self, enabled: bool, cx: &mut Context<Self>) {if self.system_audio != enabled {self.system_audio = enabled;+ if !crate::store::set_recording_system_audio(enabled) {+ tracing::warn!("Could not save the system audio setting");+ }cx.notify();}}diff --git a/apps/desktop-gpui/src/store.rs b/apps/desktop-gpui/src/store.rsindex 1745b244a..6b06c434c 100644--- a/apps/desktop-gpui/src/store.rs+++ b/apps/desktop-gpui/src/store.rs@@ -1034,6 +1034,19 @@ pub fn set_recording_camera_id(id: Option<&cap_recording::feeds::camera::DeviceOset_store_setting(RECORDING_SETTINGS, "cameraId", value)}+/// `RecordingSettingsStore.systemAudio`, which the Tauri app restored on+/// launch. Anything but a boolean reads as off.+pub fn recording_system_audio() -> bool {+ store_section(RECORDING_SETTINGS)+ .get("systemAudio")+ .and_then(Value::as_bool)+ .unwrap_or(false)+}++pub fn set_recording_system_audio(enabled: bool) -> bool {+ set_store_setting(RECORDING_SETTINGS, "systemAudio", Value::Bool(enabled))+}+pub fn set_recording_microphone_name(name: Option<&str>) -> bool {set_store_setting(RECORDING_SETTINGS,@@ -2004,6 +2017,27 @@ mod tests {assert_eq!(store.read(), expected);}+ #[test]+ fn system_audio_restores_and_saves_without_touching_devices() {+ let store = TempStore::new(+ "recording-inputs-system-audio",+ Some(r#"{"recording_settings":{"systemAudio":true,"micName":"Desk"}}"#),+ );+ assert!(recording_system_audio());++ assert!(set_recording_system_audio(false));+ assert!(!recording_system_audio());+ assert_eq!(store.read()[RECORDING_SETTINGS]["systemAudio"], false);+ assert_eq!(store.read()[RECORDING_SETTINGS]["micName"], "Desk");+ drop(store);++ let _store = TempStore::new(+ "recording-inputs-system-audio-malformed",+ Some(r#"{"recording_settings":{"systemAudio":"yes"}}"#),+ );+ assert!(!recording_system_audio());+ }+#[test]fn recording_inputs_keep_saved_identity_without_device_enumeration() {let store = TempStore::new(