Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e5a9fe0
docs: add implementation plan for windows-single-notification
danshapiro Nov 27, 2026
0bec2c5
docs: update plan from load-bearing validation
danshapiro Nov 27, 2026
cc4bc4b
docs: address Fresh Eyes plan review round 1 findings
danshapiro Nov 27, 2026
c338329
docs: address Fresh Eyes plan review round 2 findings
danshapiro Nov 27, 2026
a1d351e
feat(contracts,desktop): add Windows thread notification IPC bridge
danshapiro Nov 27, 2026
78469ed
docs(plan): mark task 1 complete
danshapiro Nov 27, 2026
3bea500
feat(desktop): manage single Windows background thread notification
danshapiro Nov 27, 2026
0a38032
fix(desktop): retain deferred-close Windows notifications and harden …
danshapiro Nov 27, 2026
2bc182c
docs(plan): mark task 2 complete
danshapiro Nov 27, 2026
8121179
feat(web): use single Windows background thread notification
danshapiro Nov 27, 2026
a2319f2
fix(web): harden Windows Service Worker recovery and notification tests
danshapiro Nov 27, 2026
959ef26
docs(plan): mark task 3 complete
danshapiro Nov 27, 2026
ec35067
fix(web): clear lingering Windows SW notifications on focused startup
danshapiro Nov 27, 2026
7d69dd7
fix(desktop,web): keep Windows thread notification banner on screen u…
danshapiro Nov 29, 2026
1767593
chore: update Windows notifications branch to v0.1.12
danshapiro Dec 2, 2026
90de6a7
fix(web): keep notification startup independent of composer state
danshapiro Dec 2, 2026
ccd9981
chore: avoid an upstream conflict in notification worker checks
danshapiro Dec 2, 2026
7605f3f
fix(web): clear stale banners after cancelled replacements
danshapiro Dec 2, 2026
3a06ef3
fix(web): keep overlapping notification cleanups independent
danshapiro Dec 2, 2026
68a13bd
fix(web): serialize Windows notification display and cleanup
danshapiro Dec 2, 2026
63c1d17
fix(web): preserve newer Windows alerts when older threads are hidden
danshapiro Dec 3, 2026
3c61928
Merge remote-tracking branch 'origin/main' into t3/preload-finished-t…
juliusmarminge Dec 3, 2026
1fc3d89
test: cut Windows thread notification tests to regressions that matter
juliusmarminge Dec 3, 2026
a65abed
fix(web): fall back to web notifications when the native toast fails
danshapiro Dec 3, 2026
9ef3b36
fix(web): reveal a minimized window from fallback notification clicks
danshapiro Dec 3, 2026
bc3ffb3
fix(web): count every unread thread when Windows alerts queue together
danshapiro Dec 3, 2026
1c5766c
fix(web): stop stalling browser alerts when SW registration has no wo…
danshapiro Dec 3, 2026
98e6c92
fix(desktop): keep a clicked toast activatable across suppressed shows
danshapiro Dec 3, 2026
32af144
fix(desktop): remove superseded timed-out toasts from Action Center
danshapiro Dec 3, 2026
e39ebc7
fix(web): retire a fallback banner when a native toast takes over
danshapiro Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions apps/desktop/src/electron/ElectronWindow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,67 @@ describe("ElectronWindow", () => {
}).pipe(Effect.provide(layerTestFor("win32"))),
);

it.effect("forces Windows foreground activation when requested without prior prepareReveal", () =>
Effect.gen(function* () {
const expectedTarget = {
windowId: 41,
processId: process.pid,
title: "T3 Code (Dev)",
bounds: { x: 200, y: 100, width: 2_400, height: 1_600 },
contentBounds: { x: 216, y: 100, width: 2_368, height: 1_584 },
};

// Direct forced reveal without prepareReveal uses Windows foreground activation.
yield* Effect.gen(function* () {
const window = makeWindowsRevealWindow();
const electronWindow = yield* ElectronWindow.ElectronWindow;
yield* electronWindow.reveal(window as unknown as Electron.BrowserWindow, {
forceWindowsForeground: true,
});

assert.lengthOf(appFocusMock.mock.calls, 1);
assert.lengthOf(window.show.mock.calls, 1);
assert.lengthOf(window.moveTop.mock.calls, 1);
assert.lengthOf(window.focus.mock.calls, 1);
assert.lengthOf(activateWindowsForegroundMock.mock.calls, 1);
assert.lengthOf(startWindowsForegroundFocusThreadMock.mock.calls, 0);
}).pipe(Effect.provide(layerTestFor("win32")));

// Shell-hosted foreground lazily starts the UIA worker without prior prepareReveal.
shellHostedForegroundMock.mockResolvedValueOnce(true);
yield* Effect.gen(function* () {
const window = makeWindowsRevealWindow();
const electronWindow = yield* ElectronWindow.ElectronWindow;
yield* electronWindow.reveal(window as unknown as Electron.BrowserWindow, {
forceWindowsForeground: true,
});

assert.lengthOf(startWindowsForegroundFocusThreadMock.mock.calls, 1);
assert.deepEqual(windowsForegroundFocusMock.mock.calls[0]?.[0], expectedTarget);
assert.lengthOf(activateWindowsForegroundMock.mock.calls, 2);
}).pipe(Effect.provide(layerTestFor("win32")));

// Failed foreground activation lazily starts the UIA worker and retries activation.
startWindowsForegroundFocusThreadMock.mockClear();
windowsForegroundFocusMock.mockClear();
activateWindowsForegroundMock.mockClear();
activateWindowsForegroundMock.mockRejectedValueOnce(
new Error("Windows initially refused foreground activation"),
);
yield* Effect.gen(function* () {
const window = makeWindowsRevealWindow();
const electronWindow = yield* ElectronWindow.ElectronWindow;
yield* electronWindow.reveal(window as unknown as Electron.BrowserWindow, {
forceWindowsForeground: true,
});

assert.lengthOf(startWindowsForegroundFocusThreadMock.mock.calls, 1);
assert.deepEqual(windowsForegroundFocusMock.mock.calls[0]?.[0], expectedTarget);
assert.lengthOf(activateWindowsForegroundMock.mock.calls, 2);
}).pipe(Effect.provide(layerTestFor("win32")));
}),
);

it.effect("reports which windows were created with a title bar overlay", () =>
Effect.gen(function* () {
const framed = { isDestroyed: () => false };
Expand Down
29 changes: 17 additions & 12 deletions apps/desktop/src/electron/ElectronWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ export class ElectronWindow extends Context.Service<
readonly setMain: (window: Electron.BrowserWindow) => Effect.Effect<void>;
readonly clearMain: (window: Option.Option<Electron.BrowserWindow>) => Effect.Effect<void>;
readonly prepareReveal: (window: Electron.BrowserWindow) => Effect.Effect<boolean>;
readonly reveal: (window: Electron.BrowserWindow) => Effect.Effect<void>;
readonly reveal: (
window: Electron.BrowserWindow,
options?: { readonly forceWindowsForeground?: boolean },
) => Effect.Effect<void>;
readonly sendAll: (channel: string, ...args: readonly unknown[]) => Effect.Effect<void>;
readonly destroyAll: Effect.Effect<void>;
readonly syncAllAppearance: <E, R>(
Expand Down Expand Up @@ -281,30 +284,32 @@ export const make = Effect.gen(function* () {
.catch(() => false);
});
}),
reveal: Effect.fn("ElectronWindow.reveal")(function (window) {
reveal: Effect.fn("ElectronWindow.reveal")(function (window, options) {
return Effect.tryPromise({
try: async () => {
if (window.isDestroyed()) {
return;
}

const captureReveal = platform === "win32" && captureRevealWindows.delete(window.id);
const forceWindowsForeground =
platform === "win32" &&
(captureRevealWindows.delete(window.id) || options?.forceWindowsForeground === true);
const shellHostedForeground =
captureReveal && (await isWindowsShellHostedForeground().catch(() => false));
forceWindowsForeground && (await isWindowsShellHostedForeground().catch(() => false));

if (window.isMinimized()) {
window.restore();
}

if (captureReveal) {
if (forceWindowsForeground) {
Electron.app.focus();
}

if (captureReveal || !window.isVisible()) {
if (forceWindowsForeground || !window.isVisible()) {
window.show();
}

if (captureReveal) {
if (forceWindowsForeground) {
window.moveTop();
}

Expand All @@ -314,19 +319,19 @@ export const make = Effect.gen(function* () {

window.focus();

if (captureReveal) {
if (forceWindowsForeground) {
if (shellHostedForeground) {
await windowsForegroundFocus
?.focus(windowsForegroundFocusTarget(window))
await ensureWindowsForegroundFocus()
.focus(windowsForegroundFocusTarget(window))
.catch(() => false);
}
try {
await activateWindowsForeground(window.getNativeWindowHandle());
} catch {
const needsFocus = !(await isWindowsBrowserWindowForeground(window));
if (needsFocus && !window.isDestroyed()) {
await windowsForegroundFocus
?.focus(windowsForegroundFocusTarget(window))
await ensureWindowsForegroundFocus()
.focus(windowsForegroundFocusTarget(window))
.catch(() => false);
}
if (!window.isDestroyed()) {
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/src/ipc/DesktopIpcHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from "./methods/appleSpeech.ts";
import * as DesktopIpc from "./DesktopIpc.ts";
import { installNotificationBadge } from "./methods/notificationBadge.ts";
import { installThreadNotification } from "./methods/threadNotification.ts";
import { getClientSettings, setClientSettings } from "./methods/clientSettings.ts";
import { getConnectionCatalog, setConnectionCatalog } from "./methods/connectionCatalog.ts";
import {
Expand Down Expand Up @@ -98,6 +99,7 @@ import {
export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers")(function* () {
const ipc = yield* DesktopIpc.DesktopIpc;
yield* installNotificationBadge();
yield* installThreadNotification();
yield* PreviewIpc.installPreviewEventForwarding();

yield* ipc.handle(AppActivationIpc.setReady);
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop/src/ipc/channels.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export const PICK_FOLDER_CHANNEL = "desktop:pick-folder";
export const TO_LOCAL_BACKEND_PATH_CHANNEL = "desktop:to-local-backend-path";
export const SET_NOTIFICATION_BADGE_CHANNEL = "desktop:set-notification-badge";
export const SHOW_THREAD_NOTIFICATION_CHANNEL = "desktop:show-thread-notification";
export const DISMISS_THREAD_NOTIFICATION_CHANNEL = "desktop:dismiss-thread-notification";
export const THREAD_NOTIFICATION_ACTIVATE_CHANNEL = "desktop:thread-notification-activate";
export const PICK_PROJECT_FAVICON_CHANNEL = "desktop:pick-project-favicon";
export const PICK_THEME_FILES_CHANNEL = "desktop:pick-theme-files";
export const SET_THEME_CHANNEL = "desktop:set-theme";
Expand Down
Loading
Loading