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
+9
View File
@@ -592,6 +592,8 @@ interface UIStore {
nativeNotificationsEnabled: boolean;
notificationMode: 'always' | 'hidden-only';
notifyOnSubtasks: boolean;
// Desktop dock badge showing the count of sessions with unseen activity (macOS).
dockBadgeEnabled: boolean;
// Event toggles (which events trigger notifications)
notifyOnCompletion: boolean;
@@ -750,6 +752,7 @@ interface UIStore {
setNotificationMode: (mode: 'always' | 'hidden-only') => void;
setShowTerminalQuickKeysOnDesktop: (value: boolean) => void;
setNotifyOnSubtasks: (value: boolean) => void;
setDockBadgeEnabled: (value: boolean) => void;
setNotifyOnCompletion: (value: boolean) => void;
setNotifyOnError: (value: boolean) => void;
setNotifyOnQuestion: (value: boolean) => void;
@@ -877,6 +880,7 @@ export const useUIStore = create<UIStore>()(
nativeNotificationsEnabled: false,
notificationMode: 'hidden-only',
notifyOnSubtasks: true,
dockBadgeEnabled: true,
// Event toggles (which events trigger notifications)
notifyOnCompletion: true,
@@ -1975,6 +1979,10 @@ export const useUIStore = create<UIStore>()(
set({ notifyOnSubtasks: value });
},
setDockBadgeEnabled: (value) => {
set({ dockBadgeEnabled: value });
},
setNotifyOnCompletion: (value) => { set({ notifyOnCompletion: value }); },
setNotifyOnError: (value) => { set({ notifyOnError: value }); },
setNotifyOnQuestion: (value) => { set({ notifyOnQuestion: value }); },
@@ -2243,6 +2251,7 @@ export const useUIStore = create<UIStore>()(
notificationMode: state.notificationMode,
showTerminalQuickKeysOnDesktop: state.showTerminalQuickKeysOnDesktop,
notifyOnSubtasks: state.notifyOnSubtasks,
dockBadgeEnabled: state.dockBadgeEnabled,
notifyOnCompletion: state.notifyOnCompletion,
notifyOnError: state.notifyOnError,
notifyOnQuestion: state.notifyOnQuestion,