Skip to content

The VS Code of video editing, built for agents.

TypeScript

Add WINDOW_SHOW channel and integrate into upgrade dialog

konstantin-paulusc4fbd51f1d5f
diff --git a/apps/desktop/src/main-channels.ts b/apps/desktop/src/main-channels.ts
index e6d2db59..67673215 100644
--- a/apps/desktop/src/main-channels.ts
+++ b/apps/desktop/src/main-channels.ts
@@ -37,6 +37,7 @@ export const MAIN_CHANNELS = {
WINDOW_SET_COLOR_MODE: "window:set-color-mode",
WINDOW_CAPTURE: "window:capture",
WINDOW_SET_BUSY: "window:set-busy",
+ WINDOW_SHOW: "window:show",
FILE_TRANSFER: "file:transfer",
FILE_WRITE_OPEN: "file:write-open",
FILE_WRITE_CHUNK: "file:write-chunk",
@@ -194,6 +195,7 @@ export type MainRequestMap = {
[MAIN_CHANNELS.WINDOW_SET_COLOR_MODE]: { request: { mode: "light" | "dark" }; response: void };
[MAIN_CHANNELS.WINDOW_CAPTURE]: { request: void; response: ScreenshotResult };
[MAIN_CHANNELS.WINDOW_SET_BUSY]: { request: { busy: boolean }; response: void };
+ [MAIN_CHANNELS.WINDOW_SHOW]: { request: void; response: void };
[MAIN_CHANNELS.FILE_TRANSFER]: {
request: { selector: string; absolutePath: string };
response: void;
diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
index 25b86e4d..fc9006ef 100644
--- a/apps/desktop/src/main.ts
+++ b/apps/desktop/src/main.ts
@@ -365,6 +365,7 @@ if (squirrelLaunch) {
mainBridge.handle(MAIN_CHANNELS.WINDOW_IS_FULLSCREEN, () => mainWindow?.isFullScreen() ?? false);
mainBridge.handle(MAIN_CHANNELS.WINDOW_SET_COLOR_MODE, ({ mode }) => setColorMode(mode));
mainBridge.handle(MAIN_CHANNELS.WINDOW_SET_BUSY, ({ busy }) => windows.setBusy(busy));
+ mainBridge.handle(MAIN_CHANNELS.WINDOW_SHOW, () => windows.show());
mainBridge.handle(MAIN_CHANNELS.WINDOW_CAPTURE, async () => {
if (!mainWindow || mainWindow.isDestroyed()) throw new Error("No main window");
const image = await mainWindow.webContents.capturePage(undefined, { stayHidden: true });
diff --git a/apps/web/src/components/upgrade-dialog.tsx b/apps/web/src/components/upgrade-dialog.tsx
index 1b060735..8eceb85d 100644
--- a/apps/web/src/components/upgrade-dialog.tsx
+++ b/apps/web/src/components/upgrade-dialog.tsx
@@ -33,11 +33,17 @@ import {
startTopupCheckout,
} from "@/lib/checkout";
import { track } from "@/lib/analytics";
+import { mainBridge } from "@/lib/ipc";
+import { MAIN_CHANNELS } from "@desktop/main-channels";
const [open, setOpen] = createSignal(false);
export function showUpgradeDialog() {
setOpen(true);
+
+ if (window.desktop) {
+ mainBridge.call(MAIN_CHANNELS.WINDOW_SHOW, undefined).catch(() => {});
+ }
}
function formatCredits(value: number): string {