fix(desktop): focus the native window when a notification is clicked
CI / Build & Quality Checks (push) Successful in 10m39s
CI / Trigger Desktop Build (push) Successful in 7s

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 <noreply@anthropic.com>
This commit is contained in:
2026-07-15 23:35:18 -04:00
co-authored by Claude Opus 4.8
parent a8c99f2a45
commit 0ce5e763ad
@@ -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);
}
};