import { emit } from '@tauri-apps/api/event'; import { isTauriRuntime } from './globalShortcut'; // Pushes the current aggregate unread count to the Rust-side tray listener. // Rust mirrors it into the tray tooltip + macOS dock badge. No-op in the // browser/dev preview where the Tauri runtime isn't present. export async function updateTrayUnread(count: number): Promise { if (!isTauriRuntime()) return; try { await emit('tray-unread-update', { count: Math.max(0, Math.floor(count)) }); } catch (err: unknown) { console.warn('updateTrayUnread failed', err); } }