Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(desktop): defer editor window show until themed first paint
Richie McIlroy81c054d44c19
diff --git a/apps/desktop/src/app.tsx b/apps/desktop/src/app.tsxindex 495784a47..e7cfcc0c4 100644--- a/apps/desktop/src/app.tsx+++ b/apps/desktop/src/app.tsx@@ -154,16 +154,27 @@ function Inner() {const matches = useCurrentMatches();onMount(() => {+ let autoShow = true;for (const match of matches()) {- if (match.route.info?.AUTO_SHOW_WINDOW === false) return;+ if (match.route.info?.AUTO_SHOW_WINDOW === false)+ autoShow = false;}if (- location.pathname !== "/" &&- location.pathname !== "/camera"+ location.pathname === "/" ||+ location.pathname === "/camera") {+ return;+ }++ if (autoShow) {void currentWindow.show();void currentWindow.setFocus();+ } else {+ // The route reveals itself after its first themed paint to+ // avoid a load flash. Safety net so the window is never left+ // hidden if that self-reveal never runs (e.g. chunk load error).+ setTimeout(() => void currentWindow.show(), 2000);}});@@ -211,7 +222,11 @@ function Inner() {<Route path="/camera" component={CameraPage} /><Route path="/capture-area" component={CaptureAreaPage} /><Route path="/debug" component={DebugPage} />- <Route path="/editor" component={EditorPage} />+ <Route+ path="/editor"+ info={{ AUTO_SHOW_WINDOW: false }}+ component={EditorPage}+ /><Routepath="/in-progress-recording"component={InProgressRecordingPage}diff --git a/apps/desktop/src/routes/editor/index.tsx b/apps/desktop/src/routes/editor/index.tsxindex ca0bfdf6f..05dadaebc 100644--- a/apps/desktop/src/routes/editor/index.tsx+++ b/apps/desktop/src/routes/editor/index.tsx@@ -1,7 +1,7 @@import { Effect, getCurrentWindow } from "@tauri-apps/api/window";import { type as ostype } from "@tauri-apps/plugin-os";import { cx } from "cva";-import { createEffect, Suspense } from "solid-js";+import { createEffect, onMount, Suspense } from "solid-js";import { generalSettingsStore } from "~/store";import { commands } from "~/utils/tauri";import { Editor } from "./Editor";@@ -10,12 +10,34 @@ import { EditorSkeleton } from "./editor-skeleton";export default function () {const generalSettings = generalSettingsStore.createQuery();+ // The editor window is built hidden (AUTO_SHOW_WINDOW=false) so we can reveal+ // it only after the theme + transparency are applied and the first frame has+ // painted. Showing earlier (the old behaviour) exposed the placeholder+ // background and then the themed background, producing a visible flash.+ let revealed = false;+ const reveal = () => {+ if (revealed) return;+ revealed = true;+ const w = getCurrentWindow();+ void w.show().catch(() => {});+ void w.setFocus().catch(() => {});+ };+createEffect(() => {const transparent = generalSettings.data?.windowTransparency ?? false;commands.setWindowTransparent(transparent);getCurrentWindow().setEffects({effects: transparent ? [Effect.HudWindow] : [],});+ // Once settings have loaded (theme + transparency are now applied), reveal+ // on the next frame so the styled background paints before the window is+ // visible.+ if (generalSettings.data) requestAnimationFrame(reveal);+ });++ // Hard fallback: never leave the window hidden if settings fail to load.+ onMount(() => {+ setTimeout(reveal, 1000);});return (