Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop): emit main-window-ready when root chrome route mounts

Richie McIlroyc7426350d073
diff --git a/apps/desktop/src/routes/(window-chrome).tsx b/apps/desktop/src/routes/(window-chrome).tsx
index e9c1c8694..c092f6ea6 100644
--- a/apps/desktop/src/routes/(window-chrome).tsx
+++ b/apps/desktop/src/routes/(window-chrome).tsx
@@ -1,5 +1,6 @@
import type { RouteSectionProps } from "@solidjs/router";
import type { UnlistenFn } from "@tauri-apps/api/event";
+import { emit } from "@tauri-apps/api/event";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { type as ostype } from "@tauri-apps/plugin-os";
import { cx } from "cva";
@@ -24,6 +25,9 @@ export default function (props: RouteSectionProps) {
__CAP__?: { initialTargetMode?: unknown };
};
const hasInitialTargetMode = __CAP__?.initialTargetMode != null;
+ if (location.pathname === "/") {
+ void emit("main-window-ready");
+ }
if (location.pathname === "/" && !hasInitialTargetMode)
getCurrentWindow().show();
});