CodeNomad/packages/electron-app/NOTIFICATION_BADGES.md
Pascal André 6a90f1e520
feat(notifications): mirror unread history on browser and desktop icons
Project the existing bell/history unread count onto browser tab favicons and the native dock or taskbar in both Electron and Tauri. Reading, deleting or clearing notifications updates the badge without querying sessions or adding polling; the original favicon returns when no unread items remain.

Aggregate per-window counts in the native hosts, accept bounded count-only calls from owned local and remote primary renderers, and keep preferences windows and preview guests outside the capability. Navigation and closure remove only that window's contribution, with document-generation and main-frame checks fencing stale updates. Windows overlays are generated by the host; other platforms use available native count APIs.

Add real Chromium regressions for notification lifecycle, icon pixels and restoration, unavailable native support and late image completion, alongside focused Electron bridge/security and Tauri state/ACL tests. UI/Electron typechecks, 15 focused Electron Node tests, four Tauri tests and Windows Tauri resource prebuild/smoke checks pass; no installed app or shared daemon was restarted.
2026-10-07 16:15:13 +02:00

970 B
Raw Permalink Blame History

Notification icon badges

electronAPI.setNotificationBadge(count): Promise<void> publishes this main renderer’s unread bell/history count (an integer from 0 through 50). Registered local and remote primary renderers may call it; Preferences and browser guests cannot. The host sums live window contributions without querying the backend.

Reload/navigation, renderer crashes and window closure clear only that window. Windows uses a host-generated red counter overlay on main windows (99+ above 99); macOS and supported Linux desktops use Electron’s application badge API. Unsupported Linux launchers can ignore badges. No OS notification permission is needed. Counts and badge pixels are never persisted.

Check without launching Electron:

node --import tsx --test packages/electron-app/electron/main/notification-badge.test.ts packages/electron-app/electron/preload/index.test.ts
npm run typecheck --workspace @neuralnomads/codenomad-electron-app