feat: desktop tray unread overlay + taskbar flash on new mention
CI / Build & Quality Checks (push) Successful in 10m29s
Trigger Desktop Build / trigger (push) Successful in 15s

Extends useTauriNotificationBadge to also invoke set_tray_unread (mirror the
unread-mention state onto the tray icon, visible when minimized) and flash_window
(flash the taskbar button when new mentions arrive while the window is unfocused).
No-op outside Tauri.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-13 23:53:39 -04:00
parent 053b364a44
commit 107921e0d0
+11 -1
View File
@@ -1,4 +1,4 @@
import { useEffect } from 'react';
import { useEffect, useRef } from 'react';
import { useAtomValue } from 'jotai';
import { roomToUnreadAtom } from '../state/room/roomToUnread';
@@ -10,6 +10,7 @@ const tauriInvoke = (): TauriInternals['invoke'] | undefined =>
export function useTauriNotificationBadge() {
const roomToUnread = useAtomValue(roomToUnreadAtom);
const prevHighlightsRef = useRef(0);
useEffect(() => {
const invoke = tauriInvoke();
@@ -21,5 +22,14 @@ export function useTauriNotificationBadge() {
});
invoke('set_badge_count', { count: totalHighlights }).catch(() => {});
// Mirror the unread state onto the tray icon (visible when minimized to tray).
invoke('set_tray_unread', { unread: totalHighlights > 0 }).catch(() => {});
// Flash the taskbar button when new mentions arrive and the window is not
// focused, then reset the baseline.
if (totalHighlights > prevHighlightsRef.current && !document.hasFocus()) {
invoke('flash_window').catch(() => {});
}
prevHighlightsRef.current = totalHighlights;
}, [roomToUnread]);
}