A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
fix(island): give the borrowed front back when the island closes
Claudec68a39ee6b16
diff --git a/windows/src/island/hooks.ts b/windows/src/island/hooks.tsindex 6219ad19..a5e52d79 100644--- a/windows/src/island/hooks.ts+++ b/windows/src/island/hooks.ts@@ -470,7 +470,10 @@ function handleHook(island: Island, payload: HookPayload) {agentId,window.setTimeout(() => {stopTimers.delete(agentId);- restoreAlertFocus();+ // While the island is open the alert's card stays on its own pill, and the+ // pill you had comes back when it closes (island.ts), as on the Mac. An agent+ // pill about to go hands the front back now.+ if (isExternalAgent || State.mode !== "expanded") restoreAlertFocus();if (isExternalAgent) {State.removeTask(agentId);} else {diff --git a/windows/src/island/island.ts b/windows/src/island/island.tsindex 865556a9..f3627730 100644--- a/windows/src/island/island.ts+++ b/windows/src/island/island.ts@@ -388,6 +388,8 @@ export class Island {// A folded card is still waiting: it keeps the island pinned.if (!State.pendingApproval) State.isPinned = false;void Bridge.focusWindow(false);+ // Another pill's alert borrowed the front: the pill you had comes back (Mac).+ restoreAlertFocus();}if (mode !== "expanded") {closePlanCard();@@ -445,7 +447,6 @@ export class Island {this.foldApproval();return;}- restoreAlertFocus();State.isPinned = false;this.fsm.pinned = false;// Drive the state machine rather than the mode: setting the mode behind itsdiff --git a/windows/tests/hooks.test.mjs b/windows/tests/hooks.test.mjsindex 1dfe12a1..064cfcf9 100644--- a/windows/tests/hooks.test.mjs+++ b/windows/tests/hooks.test.mjs@@ -5,7 +5,7 @@import { afterEach, beforeEach, mock, test } from "node:test";import assert from "node:assert/strict";import { calls, emit, sent } from "./tauri.mjs";-import { registerHookHandlers } from "../src/island/hooks.ts";+import { registerHookHandlers, restoreAlertFocus } from "../src/island/hooks.ts";import { DEFAULT_SETTINGS, State } from "../src/core/state.ts";import { Sound } from "../src/core/sound.ts";import { setLanguage } from "../src/i18n/i18n.ts";@@ -190,6 +190,18 @@ test("alertsFromAllPills: unfocused pill alert opens the island and restores focState.settings.alertsFromAllPills = false;});+test("alertsFromAllPills: while the island is open the alert's pill keeps the front", () => {+ State.settings.alertsFromAllPills = true;+ State.setFocus("integration_n8n");+ hook({ hook_event_name: "Stop" });+ State.mode = "expanded";+ seconds(5.2);+ // The finished card still names the pill that finished; closing gives n8n back.+ assert.equal(State.focusId, "integration_claude");+ restoreAlertFocus();+ assert.equal(State.focusId, "integration_n8n");+});+test("a failed stop shows the error view, or the error badge behind another pill", () => {hook({ hook_event_name: "StopFailure" });assert.equal(task().state, "error");