Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop): gate screenshot editor on automation rules in overlay

Richie McIlroy13e443f131b2
diff --git a/apps/desktop/src/routes/target-select-overlay.tsx b/apps/desktop/src/routes/target-select-overlay.tsx
index 21b58e77a..01f8e9df4 100644
--- a/apps/desktop/src/routes/target-select-overlay.tsx
+++ b/apps/desktop/src/routes/target-select-overlay.tsx
@@ -4,7 +4,6 @@ import { createElementSize } from "@solid-primitives/resize-observer";
import { makePersisted } from "@solid-primitives/storage";
import { useSearchParams } from "@solidjs/router";
import { createMutation, useQuery } from "@tanstack/solid-query";
-import { invoke } from "@tauri-apps/api/core";
import {
LogicalPosition,
type PhysicalPosition,
@@ -1073,10 +1072,12 @@ function Inner() {
}
await new Promise((resolve) => setTimeout(resolve, 50));
- const path = await invoke<string>("take_screenshot", {
- target,
- });
- await commands.showWindow({ ScreenshotEditor: { path } });
+ const path = await commands.takeScreenshot(target);
+ const shouldOpenEditor =
+ await commands.automationShouldOpenScreenshotEditor(target);
+ if (shouldOpenEditor) {
+ await commands.showWindow({ ScreenshotEditor: { path } });
+ }
await commands.closeTargetSelectOverlays();
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
@@ -1716,10 +1717,14 @@ function RecordingControls(props: {
}
}
- const path = await invoke<string>("take_screenshot", {
- target: props.target,
- });
- await commands.showWindow({ ScreenshotEditor: { path } });
+ const path = await commands.takeScreenshot(props.target);
+ const shouldOpenEditor =
+ await commands.automationShouldOpenScreenshotEditor(
+ props.target,
+ );
+ if (shouldOpenEditor) {
+ await commands.showWindow({ ScreenshotEditor: { path } });
+ }
await commands.closeTargetSelectOverlays();
} catch (e) {
const message = e instanceof Error ? e.message : String(e);