feat(desktop): add macOS dock badge for chats with unseen activity

Show a count of chats (root sessions) with unseen activity on the macOS
dock icon. The count is computed in the existing tray snapshot (full
cross-project list, not the capped tray view; a subtask's unseen rolls up
to its root only when subtask notifications are enabled) and pushed to the
main process over the existing desktop_tray_update IPC, which calls
app.setBadgeCount (0 clears it). The badge clears as sessions are marked
seen on window focus.

Add a Dock badge toggle in Appearance settings (default on, persisted,
darwin desktop only), localized across all dictionaries, with a matching
settings-search entry whose availability mirrors the render guard exactly.
This commit is contained in:
Bohdan Triapitsyn
2026-06-28 01:07:52 +03:00
parent 00efd8cc4b
commit 84d7303346
16 changed files with 129 additions and 3 deletions
+11
View File
@@ -3265,6 +3265,17 @@ const handleInvoke = async (browserWindow, command, args = {}) => {
log.warn('[electron] tray update failed', error);
}
}
// Dock badge: count of chats with unseen activity (0 = cleared, also when
// the user disabled the badge). setBadgeCount drives the macOS dock badge.
try {
const rawCount = args && typeof args.dockBadgeCount === 'number' ? args.dockBadgeCount : 0;
const badgeCount = Number.isFinite(rawCount) ? Math.max(0, Math.floor(rawCount)) : 0;
if (typeof app.setBadgeCount === 'function') {
app.setBadgeCount(badgeCount);
}
} catch (error) {
log.warn('[electron] dock badge update failed', error);
}
return null;
case 'desktop_clear_cache':