Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(windows): first unread report is a badge baseline, not a taskbar flash
reviewb720e639bb0a
diff --git a/src/main/index.ts b/src/main/index.tsindex 98963a90b..d46ddcb50 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -906,10 +906,6 @@ const browserGuests = new Map<number, BrowserGuest>()const nodeContextSession = new Map<string, string>()const nodeSubagents = new Map<string, Set<string>>() // nodeId → active subagent tool_use_ids-// Enforce a single instance. A second instance would re-attach every node's tmux session-// (`new-session -A -D`), whose `-D` detaches the first instance's clients — leaving-// "[detached (from session ...)]" dead terminals. Bail out and focus the existing window-// instead. (This guards against a stray real GUI launch.)// Windows toast identity, BEFORE any Notification and before ready (src/main/app-identity.ts):// without it Electron's generated `electron.app.<name>` id matches no Start-menu shortcut and// toasts are dropped or mis-attributed — silently. Null (no call) on macOS/Linux.@@ -917,6 +913,11 @@ const nodeSubagents = new Map<string, Set<string>>() // nodeId → active subageconst aumid = appUserModelIdFor({ platform: process.platform, isPackaged: app.isPackaged, execPath: process.execPath })if (aumid) app.setAppUserModelId(aumid)}++// Enforce a single instance. A second instance would re-attach every node's tmux session+// (`new-session -A -D`), whose `-D` detaches the first instance's clients — leaving+// "[detached (from session ...)]" dead terminals. Bail out and focus the existing window+// instead. (This guards against a stray real GUI launch.)const gotSingleInstanceLock = NT_MULTI || app.requestSingleInstanceLock()if (!gotSingleInstanceLock) {app.quit()@@ -1839,7 +1840,7 @@ app.whenReady().then(async () => {// Windows → a taskbar overlay icon + a flash when the count rises in the background; Linux →// nothing. The decision is the pure `planBadge` (taskbar-badge.ts). The same count feeds the// background-mode tray's tooltip/menu (de-duplicated there, so a resend rebuilds nothing).- let lastBadgeCount = 0+ let lastBadgeCount: number | null = null // null until the first report: that one is a baselineipcMain.on(IPC.appSetBadge, (_e, count: number) => {const n = normalizeUnread(count)const win = getMainWindow() as unknown as BrowserWindow | nulldiff --git a/src/main/taskbar-badge.test.ts b/src/main/taskbar-badge.test.tsindex 87b71d681..a1a44198a 100644--- a/src/main/taskbar-badge.test.ts+++ b/src/main/taskbar-badge.test.ts@@ -1,4 +1,6 @@import { describe, expect, it } from 'vitest'+import { readFileSync } from 'fs'+import { join } from 'path'import { badgeLabel, planBadge, rasterizeBadge } from './taskbar-badge'describe('planBadge', () => {@@ -20,6 +22,16 @@ describe('planBadge', () => {expect(planBadge('win32', 1, 2, false).flash).toBe(false)expect(planBadge('win32', 2, 2, false).flash).toBe(false)})+ it('Windows: the first report (persisted unread restored at boot) is a baseline — draws, never flashes', () => {+ expect(planBadge('win32', 3, null, false)).toEqual({+ overlay: { label: '3', description: '3 unread sessions' },+ flash: false+ })+ })+ it('main seeds the baseline as null, not 0 (source guard)', () => {+ const src = readFileSync(join(__dirname, 'index.ts'), 'utf-8')+ expect(src).toMatch(/let lastBadgeCount: number \| null = null/)+ })it('Linux: nothing', () => {expect(planBadge('linux', 5, 0, false)).toEqual({})})diff --git a/src/main/taskbar-badge.ts b/src/main/taskbar-badge.tsindex 5f75dcddc..c970b4709 100644--- a/src/main/taskbar-badge.ts+++ b/src/main/taskbar-badge.ts@@ -22,7 +22,10 @@ export function badgeLabel(count: number): string {export function planBadge(platform: NodeJS.Platform | string,count: number,- prevCount: number,+ /** The previous report's count, or `null` for the FIRST report of this process. The renderer+ * restores persisted unread flags at boot and reports them at once — before the window has+ * focus — so a first report is a baseline, not "something new finished while you were away". */+ prevCount: number | null,focused: boolean): BadgePlan {const n = Number.isFinite(count) && count > 0 ? Math.floor(count) : 0@@ -32,7 +35,7 @@ export function planBadge(overlay: n > 0 ? { label: badgeLabel(n), description: n === 1 ? '1 unread session' : `${n} unread sessions` } : null,// Only a RISE means "something new finished while you were away" — a falling count is the// user catching up, and re-flashing on every badge sync would be noise.- flash: n > prevCount && !focused+ flash: prevCount !== null && n > prevCount && !focused}}return {}diff --git a/src/main/tray.ts b/src/main/tray.tsindex 611a32c68..cb8f75bc3 100644--- a/src/main/tray.ts+++ b/src/main/tray.ts@@ -1,4 +1,4 @@-// Windows/Linux background-mode tray (docs: CLAUDE.md "Window lifecycle"). Created only when+// Windows/Linux background-mode tray (docs: CLAUDE.md, "Window close off macOS = background mode"). Created only when// background mode resolves on (`resolveBackgroundOnClose`), never on macOS — the Dock is the// analogue there. All decisions live in the pure ./tray-model; this file is the Electron glue.diff --git a/src/shared/types.ts b/src/shared/types.tsindex 91acbbb75..a8674ef80 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -1749,10 +1749,10 @@ export interface ZoomActualSizeModifiers {control: boolean}-/** User-configurable application settings (settings.json). *//** `settings.runInBackgroundOnClose` — see the field's doc. */export type BackgroundOnCloseSetting = 'auto' | 'on' | 'off'+/** User-configurable application settings (settings.json). */export interface Settings {fontSize: numberfontFamily: string