@devries-cameron20 / t3code-1 / commits / bb86c24139
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(desktop): raise the window when a thread notification is clicked … (#12567)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Arnab Chakraborty committed Oct 20, 2026 at 05:32 UTC bb86c24139ddc5dff2bb01ef4e298f9717ef409d
8 files changed +65
apps/desktop/src/ipc/DesktopIpcHandlers.ts
+2
@@ -48,6 +48,7 @@ import {
48 checkSystemPermission,
49 pasteAsText,
50 probeRemoteEditors,
51 + revealWindow,
52 pickFolder,
53 pickProjectFavicon,
54 pickThemeFiles,
@@ -150,6 +151,7 @@ export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers"
151 yield* ipc.handle(openSystemSettings);
152 yield* ipc.handle(checkSystemPermission);
153 yield* ipc.handle(pasteAsText);
154 + yield* ipc.handle(revealWindow);
155 yield* ipc.handle(probeRemoteEditors);
156 yield* ipc.handle(getUpdateState);
157 yield* ipc.handle(setUpdateChannel);
apps/desktop/src/ipc/channels.ts
+1
@@ -9,6 +9,7 @@ export const OPEN_SYSTEM_SETTINGS_CHANNEL = "desktop:open-system-settings";
9 export const PROBE_REMOTE_EDITORS_CHANNEL = "desktop:probe-remote-editors";
10 export const MENU_ACTION_CHANNEL = "desktop:menu-action";
11 export const PASTE_AS_TEXT_CHANNEL = "desktop:paste-as-text";
12 +export const REVEAL_WINDOW_CHANNEL = "desktop:reveal-window";
13 export const SNAP_SHOT_EVENT_CHANNEL = "desktop:snap-shot-event";
14 export const WEB_LINK_OPEN_CHANNEL = "desktop:web-link-open";
15 export const WEB_LINK_READY_CHANNEL = "desktop:web-link-ready";
apps/desktop/src/ipc/methods/window.test.ts
+21
@@ -31,6 +31,7 @@ import {
31 pasteAsText,
32 pickProjectFavicon,
33 probeRemoteEditors,
34 + revealWindow,
35 } from "./window.ts";
36
37 const readyWslConfig: DesktopBackendManager.DesktopBackendStartConfig = {
@@ -257,6 +258,26 @@ describe("pasteAsText", () => {
258 );
259 });
260
261 +describe("revealWindow", () => {
262 + it.effect("reveals the main window only when it asks", () => {
263 + const window = { webContents: { id: 42 } } as unknown as Electron.BrowserWindow;
264 + const reveal = vi.fn(() => Effect.void);
265 + return Effect.gen(function* () {
266 + yield* revealWindow.handler(undefined, { sender: { id: 99 } });
267 + assert.equal(reveal.mock.calls.length, 0);
268 + yield* revealWindow.handler(undefined, { sender: { id: 42 } });
269 + assert.deepEqual(reveal.mock.calls, [[window]]);
270 + }).pipe(
271 + Effect.provide(
272 + Layer.mock(ElectronWindow.ElectronWindow)({
273 + main: Effect.succeedSome(window),
274 + reveal,
275 + }),
276 + ),
277 + );
278 + });
279 +});
280 +
281 describe("pickProjectFavicon", () => {
282 const pickerLayer = (
283 pickFiles: () => Effect.Effect<Array<string>>,
apps/desktop/src/ipc/methods/window.ts
+18
@@ -352,6 +352,24 @@ export const pasteAsText = DesktopIpc.makeIpcMethod({
352 }),
353 });
354
355 +export const revealWindow = DesktopIpc.makeIpcMethod({
356 + channel: IpcChannels.REVEAL_WINDOW_CHANNEL,
357 + payload: Schema.Undefined,
358 + result: Schema.Void,
359 + handler: Effect.fn("desktop.ipc.window.revealWindow")(function* (_input, event) {
360 + const electronWindow = yield* ElectronWindow.ElectronWindow;
361 + const window = yield* electronWindow.main;
362 + if (
363 + event === undefined ||
364 + Option.isNone(window) ||
365 + window.value.webContents.id !== event.sender.id
366 + ) {
367 + return;
368 + }
369 + yield* electronWindow.reveal(window.value);
370 + }),
371 +});
372 +
373 const PICKED_THEME_FILE_MAX_BYTES = 256 * 1024;
374
375 export const pickThemeFiles = DesktopIpc.makeIpcMethod({
apps/desktop/src/preload.ts
+1
@@ -96,6 +96,7 @@ contextBridge.exposeInMainWorld("desktopBridge", {
96 ipcRenderer.on(IpcChannels.TRACKPAD_SCROLL_END_CHANNEL, handler);
97 return () => ipcRenderer.removeListener(IpcChannels.TRACKPAD_SCROLL_END_CHANNEL, handler);
98 },
99 + revealWindow: () => ipcRenderer.invoke(IpcChannels.REVEAL_WINDOW_CHANNEL),
100 getSystemLocale: () => {
101 const result = ipcRenderer.sendSync(IpcChannels.GET_SYSTEM_LOCALE_CHANNEL);
102 return typeof result === "string" ? result : null;
apps/web/src/components/ThreadNotificationCoordinator.browser.test.tsx
+16
@@ -359,4 +359,20 @@ describe("thread notifications", () => {
359 silent: true,
360 });
361 });
362 +
363 + it("reveals the desktop window and opens the thread when a system alert is clicked", async () => {
364 + const revealWindow = vi.fn(() => Promise.resolve());
365 + vi.stubGlobal("desktopBridge", { revealWindow });
366 + state.mode = "notifications";
367 + state.focused = false;
368 + await render();
369 + await complete();
370 + const notification: EventTarget = state.notification.mock.results[0]?.value;
371 + notification.dispatchEvent(new Event("click"));
372 + expect(revealWindow).toHaveBeenCalledTimes(1);
373 + expect(state.navigate).toHaveBeenCalledWith({
374 + to: "/$environmentId/$threadId",
375 + params: { environmentId: "env-1", threadId: "thread-1" },
376 + });
377 + });
378 });
apps/web/src/components/ThreadNotificationCoordinator.tsx
+1
@@ -226,6 +226,7 @@ function EnvironmentNotifications({
226 notification.addEventListener("click", () => {
227 notification.close();
228 window.focus();
229 + void window.desktopBridge?.revealWindow?.().catch(() => undefined);
230 void navigate({
231 to: "/$environmentId/$threadId",
232 params: { environmentId, threadId: thread.id },
packages/contracts/src/ipc.ts
+5
@@ -1032,6 +1032,11 @@ export interface DesktopBridge {
1032 setNotificationBadge?: (badge: { count: number; image: string | null }) => Promise<void>;
1033 onNotificationBadgeClear?: (listener: () => void) => () => void;
1034 onTrackpadScrollEnd?: (listener: () => void) => () => void;
1035 + /**
1036 + * Renderer `window.focus()` cannot raise an Electron window, and on Wayland
1037 + * only the main process can spend a notification click's activation token.
1038 + */
1039 + revealWindow?: () => Promise<void>;
1040 /**
1041 * The OS locale as a BCP-47 tag, which the renderer cannot read for itself:
1042 * the packaged app ships only the `en-US` Chromium locale pak, so