From 0ce5e763ad6d3847256c8898ce422dbdf6583edc Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Wed, 15 Jul 2026 23:35:18 -0400 Subject: [PATCH] fix(desktop): focus the native window when a notification is clicked On cinny-desktop (Tauri/WebView2) a clicked notification navigated the web content but never raised the OS window (a service-worker/WebView2 client.focus() only focuses the document). The service-worker notificationClick path now calls a new focus_main_window Tauri command via invokeTauri (no-op outside Tauri) in addition to navigating; the rich-toast path is focused natively on the Rust side. Co-Authored-By: Claude Opus 4.8 --- src/app/pages/client/ClientNonUIFeatures.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/pages/client/ClientNonUIFeatures.tsx b/src/app/pages/client/ClientNonUIFeatures.tsx index 6ff73b64c..9c19a1c67 100644 --- a/src/app/pages/client/ClientNonUIFeatures.tsx +++ b/src/app/pages/client/ClientNonUIFeatures.tsx @@ -55,6 +55,7 @@ import { toastQueueAtom } from '../../state/toast'; import { useReminders } from '../../hooks/useReminders'; import { getRoomRetentionMs, isExpired } from '../../utils/retention'; import { useTauriUpdater } from '../../hooks/useTauriUpdater'; +import { invokeTauri } from '../../hooks/useTauri'; import { TauriDesktopFeatures } from '../../components/TauriDesktopFeatures'; import { KeyboardShortcutsDialog, useKeyboardShortcutsTrigger } from '../../features/shortcuts'; import { useRoomsListener } from '../../hooks/useRoomsListener'; @@ -485,6 +486,10 @@ function MessageNotifications() { const onMessage = (event: MessageEvent) => { const data = event.data ?? {}; if (data.type === 'notificationClick' && typeof data.path === 'string') { + // On desktop, raise the native window — a service-worker/WebView2 + // `client.focus()` only focuses the document, not the OS window. No-op + // outside Tauri. + invokeTauri('focus_main_window'); navigate(data.path); } };