Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Delete on backend after closing window (#1029)
Brendan Allan428bb0eadf39
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex 492616968..a68225690 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -285,7 +285,7 @@ pub struct NewStudioRecordingAdded {path: PathBuf,}-#[derive(specta::Type, tauri_specta::Event, Debug, Clone)]+#[derive(specta::Type, tauri_specta::Event, Debug, Clone, Serialize)]pub struct RecordingDeleted {#[allow(unused)]path: PathBuf,@@ -1688,6 +1688,27 @@ async fn get_system_audio_waveforms(Ok(out)}+#[tauri::command]+#[specta::specta]+async fn editor_delete_project(+ app: tauri::AppHandle,+ editor_instance: WindowEditorInstance,+ window: tauri::Window,+) -> Result<(), String> {+ let _ = window.close();++ tokio::time::sleep(std::time::Duration::from_millis(20)).await;++ let path = editor_instance.0.project_path.clone();+ drop(editor_instance);++ let _ = tokio::fs::remove_dir_all(&path).await;++ RecordingDeleted { path }.emit(&app);++ Ok(())+}+// keep this async otherwise opening windows may hang on windows#[tauri::command]#[specta::specta]@@ -1899,6 +1920,7 @@ pub async fn run(recording_logging_handle: LoggingHandle) {target_select_overlay::close_target_select_overlays,target_select_overlay::display_information,target_select_overlay::get_window_icon,+ editor_delete_project]).events(tauri_specta::collect_events![RecordingOptionsChanged,diff --git a/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx b/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsxindex c47c20e9f..1dc37e8f8 100644--- a/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings/experimental.tsx@@ -40,7 +40,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {};return (- <div class="flex flex-col w-full h-full custom-scroll">+ <div class="flex flex-col h-full custom-scroll"><div class="p-4 space-y-4"><div class="flex flex-col pb-4 border-b border-gray-2"><h2 class="text-lg font-medium text-gray-12">diff --git a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx b/apps/desktop/src/routes/(window-chrome)/settings/general.tsxindex 1430d51ed..8b6b1f1e4 100644--- a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx@@ -372,7 +372,7 @@ function Inner(props: { initialStore: GeneralSettingsStore | null }) {};return (- <div class="flex flex-col w-full h-full custom-scroll">+ <div class="flex flex-col h-full custom-scroll"><div class="p-4 space-y-6"><AppearanceSectioncurrentTheme={settings.theme ?? "system"}diff --git a/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx b/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsxindex 6b2cbee36..333728297 100644--- a/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx@@ -94,7 +94,7 @@ function Inner(props: { initialStore: HotkeysStore | null }) {] satisfies Array<keyof typeof ACTION_TEXT>;return (- <div class="flex flex-col flex-1 p-4 w-full h-full custom-scroll">+ <div class="flex flex-col flex-1 p-4 h-full custom-scroll"><div class="flex flex-col pb-4 border-b border-gray-2"><h2 class="text-lg font-medium text-gray-12">Shortcuts</h2><p class="text-sm text-gray-10 w-full max-w-[500px]">diff --git a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx b/apps/desktop/src/routes/(window-chrome)/settings/license.tsxindex 18c8a7b3b..b10212cfd 100644--- a/apps/desktop/src/routes/(window-chrome)/settings/license.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings/license.tsx@@ -23,7 +23,7 @@ export default function Page() {const queryClient = useQueryClient();return (- <div class="flex overflow-y-auto relative flex-col gap-3 items-center p-4 mx-auto w-full h-full custom-scroll">+ <div class="flex relative flex-col gap-3 items-center p-4 mx-auto h-full custom-scroll"><Switch fallback={<CommercialLicensePurchase />}><Match when={license.data?.type === "pro" && license.data}><div class="flex justify-center items-center w-full h-screen">diff --git a/apps/desktop/src/routes/editor/Header.tsx b/apps/desktop/src/routes/editor/Header.tsxindex 82322c482..afb5a80f9 100644--- a/apps/desktop/src/routes/editor/Header.tsx+++ b/apps/desktop/src/routes/editor/Header.tsx@@ -72,15 +72,10 @@ export function Header() {{ostype() === "macos" && <div class="h-full w-[4rem]" />}<EditorButtononClick={async () => {- const currentWindow = getCurrentWindow();- if (!editorInstance.path) return;if (!(await ask("Are you sure you want to delete this recording?")))return;- await remove(editorInstance.path, {- recursive: true,- });- events.recordingDeleted.emit({ path: editorInstance.path });- await currentWindow.close();++ await commands.editorDeleteProject();}}tooltipText="Delete recording"leftIcon={<IconCapTrash class="w-5" />}diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.tsindex 1d02d52be..855e1d4a6 100644--- a/apps/desktop/src/utils/tauri.ts+++ b/apps/desktop/src/utils/tauri.ts@@ -262,6 +262,9 @@ async displayInformation(displayId: string) : Promise<DisplayInformation> {},async getWindowIcon(windowId: string) : Promise<string | null> {return await TAURI_INVOKE("get_window_icon", { windowId });+},+async editorDeleteProject() : Promise<void> {+ await TAURI_INVOKE("editor_delete_project");}}