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
feat(island): option to show Claude plan usage in compact island (#889)
unknown39a651faf0f3
diff --git a/windows/src-tauri/src/lib.rs b/windows/src-tauri/src/lib.rsindex 765772de..da90aaee 100644--- a/windows/src-tauri/src/lib.rs+++ b/windows/src-tauri/src/lib.rs@@ -473,6 +473,7 @@ fn status_line_apply(// As on the Mac: taking the relay out turns the pill off with it.if !install {current.show_plan_in_notch = false;+ current.show_plan_in_compact_island = false;}if let Err(err) = settings::save(¤t) {log::line(format!("could not save settings: {err}"));diff --git a/windows/src-tauri/src/settings.rs b/windows/src-tauri/src/settings.rsindex e3048fbe..3ed708fb 100644--- a/windows/src-tauri/src/settings.rs+++ b/windows/src-tauri/src/settings.rs@@ -32,6 +32,8 @@ pub struct Settings {/// Show the Claude plan pill (5 h and weekly limits) in the island's header./// Off until the user turns it on, so the header stays as it shipped.pub show_plan_in_notch: bool,+ /// Show the Claude plan percentage in the compact island next to the agent dots.+ pub show_plan_in_compact_island: bool,/// Coucou's status line relay is the one in Claude Code's settings.json./// Like `hooks_installed`, the real state wins at launch over what was stored.pub plan_relay_installed: bool,@@ -148,6 +150,7 @@ impl Default for Settings {hooks_installed: false,model: default_model(),show_plan_in_notch: false,+ show_plan_in_compact_island: false,plan_relay_installed: false,show_codex_plan_in_notch: false,chat_provider: crate::chat::ANTHROPIC.into(),@@ -447,6 +450,7 @@ mod tests {"hooksInstalled": true,"model": "some-model","showPlanInNotch": true,+ "showPlanInCompactIsland": true,"planRelayInstalled": true,"showCodexPlanInNotch": true,"chatProvider": "ollama",@@ -966,6 +970,7 @@ mod tests {"hooksInstalled","model","showPlanInNotch",+ "showPlanInCompactIsland","planRelayInstalled","showCodexPlanInNotch","chatProvider",diff --git a/windows/src/core/state.ts b/windows/src/core/state.tsindex bab28737..587f6bd4 100644--- a/windows/src/core/state.ts+++ b/windows/src/core/state.ts@@ -118,6 +118,8 @@ export interface Settings {model: string;/** Show the Claude plan pill (5 h and weekly limits) in the island's header. */showPlanInNotch: boolean;+ /** Show the Claude plan percentage in the compact island next to the agent dots. */+ showPlanInCompactIsland: boolean;/** Coucou's status line relay is installed in Claude Code's settings. */planRelayInstalled: boolean;/** Show the Codex plan pill in the island's header. */@@ -184,6 +186,7 @@ export const DEFAULT_SETTINGS: Settings = {hooksInstalled: false,model: "claude-opus-5",showPlanInNotch: false,+ showPlanInCompactIsland: false,planRelayInstalled: false,showCodexPlanInNotch: false,chatProvider: "anthropic",diff --git a/windows/src/i18n/extra.json b/windows/src/i18n/extra.jsonindex d765066d..29fd7fa6 100644--- a/windows/src/i18n/extra.json+++ b/windows/src/i18n/extra.json@@ -7218,6 +7218,21 @@"tr": "Anahtar yok: sohbet yukarıdaki Claude aboneliğinizi kullanabilir.","ko": "키 없음: 채팅은 위의 Claude 구독을 사용할 수 있습니다.","ja": "キーなし: チャットは上の Claude サブスクリプションを使えます。"+ },+ "Show in compact island": {+ "zh-Hans": "在收起的灵动岛中显示",+ "hi": "कॉम्पैक्ट आइलैंड में दिखाएं",+ "es": "Mostrar en la isla compacta",+ "ar": "عرض في الجزيرة المصغّرة",+ "fr": "Afficher dans l'îlot compact",+ "bn": "কম্প্যাক्ট আইল্যান্ডে দেখান",+ "pt-BR": "Mostrar na ilha compacta",+ "ru": "Показывать в компактном острове",+ "id": "Tampilkan di pulau ringkas",+ "de": "In der kompakten Insel anzeigen",+ "tr": "Kompakt adada göster",+ "ko": "컴팩트 아일랜드에 표시",+ "ja": "コンパクトアイランドに表示"}}}diff --git a/windows/src/island/island.ts b/windows/src/island/island.tsindex 090d2729..be3cbbbb 100644--- a/windows/src/island/island.ts+++ b/windows/src/island/island.ts@@ -19,7 +19,9 @@ import { createMiniBot, pruneMiniBots, syncMiniBotStates, tickMiniBots } from ".import { SeasonCache, parseOutfit } from "../mochi/wardrobe";import { UploadCanvas } from "../upload/canvas";import { USC, UploadSeq } from "../upload/sequence";-import { closePlanCard, openPlanColor, planCardOpen } from "../views/usage";+import { dominantPct, planColor } from "../core/plan";+import { tl } from "../i18n/i18n";+import { claudeCompactPillVisible, closePlanCard, openPlanColor, planCardOpen } from "../views/usage";import { buildHeader, buildViews, type ViewActions, type ViewHost } from "../views/views";import { h } from "../views/dom";import { IslandStateMachine } from "./fsm";@@ -63,6 +65,9 @@ export class Island {private clockEl!: HTMLElement;private clockTimer?: number;private countdown!: HTMLElement;+ private compactPlan!: HTMLElement;+ private compactPlanDot!: HTMLElement;+ private compactPlanLabel!: HTMLElement;private wakeStrip!: HTMLElement;private header!: ViewHost;@@ -288,6 +293,25 @@ export class Island {this.miniGrid = h("div", { id: "mini-grid" });this.clockEl = h("div", { id: "island-clock" });this.countdown = h("div", { id: "countdown" });+ this.compactPlanDot = h("i", { class: "compact-plan-dot" });+ this.compactPlanLabel = h("span", { class: "compact-plan-label" });+ this.compactPlan = h(+ "button",+ {+ id: "compact-plan",+ title: tl("Claude plan usage"),+ onmousedown: (e) => {+ e.stopPropagation();+ },+ onclick: (e) => {+ e.stopPropagation();+ const me = e as MouseEvent;+ if (me.button === 0) this.openClaudePlan();+ },+ },+ this.compactPlanDot,+ this.compactPlanLabel,+ );this.header = buildHeader(actions);this.views = buildViews(actions, () => this.animateGeometry(false));@@ -321,6 +345,7 @@ export class Island {this.botGlow,this.botCanvas,this.miniGrid,+ this.compactPlan,this.clockEl,this.countdown,);@@ -411,6 +436,18 @@ export class Island {if (UploadSeq.isActive && !UPLOAD_VIEWS.has(view)) UploadSeq.deactivate();}+ /** Click on compact plan gauge: opens the Claude plan card on the overview. */+ openClaudePlan() {+ Sound.resume();+ State.lastActivity = performance.now();+ this.fsm.userInteracted();+ State.planDetailIsCodex = false;+ State.showingPlanDetail = true;+ this.fsm.forceHome();+ this.expand("overview");+ State.notify();+ }+expand(view: IslandViewName) {this.stopSequenceIfLeaving(view);if (view !== "overview") closePlanCard();@@ -1252,6 +1289,19 @@ export class Island {}}+ // Compact Claude plan indicator+ const showPlan = claudeCompactPillVisible();+ this.compactPlan.style.opacity = showPlan ? "1" : "0";+ this.compactPlan.style.pointerEvents = showPlan ? "auto" : "none";+ if (showPlan) {+ const others = State.otherTasks.slice(0, 4);+ this.compactPlan.style.right = others.length > 0 ? "58px" : "20px";+ const pct = dominantPct(State.planUsage);+ const color = planColor(pct);+ this.compactPlan.style.setProperty("--plan", color);+ this.compactPlanLabel.textContent = pct != null ? `${Math.round(pct)}%` : "—";+ }+this.updateClock();syncMiniBotStates(State.tasks);diff --git a/windows/src/settings/main.ts b/windows/src/settings/main.tsindex 04d9609f..dfe854c4 100644--- a/windows/src/settings/main.ts+++ b/windows/src/settings/main.ts@@ -251,6 +251,7 @@ const PLAN_SETTINGS_TEXT = {get claude() { return t("Shows your Claude plan usage (5-hour and weekly limits) in the island's header. Coucou adds a status line relay in ~/.claude/settings.json. If you already have a status line, it keeps working as before. Pro and Max plans only."); },get claudeCli() { return t("The numbers come from the Claude Code command-line tool. The Claude desktop app does not report them, so the gauge stays empty if you only use the desktop app."); },get showClaude() { return t("Show in notch"); },+ get showClaudeCompact() { return t("Show in compact island"); },get codex() { return t("Shows your Codex plan usage (weekly limit and free resets left) in the island's header. Coucou asks the Codex CLI (codex app-server) when the pill shows; nothing is installed. Codex must be signed in with ChatGPT."); },get showCodex() { return t("Show Codex plan in the notch"); },};@@ -268,7 +269,10 @@ function planSection(status: HookStatus): HTMLElement {if (fresh) Object.assign(status, fresh);settings.planRelayInstalled = status.planRelayInstalled;// Cancelled or failed: a switch that was waiting for the install falls back.- if (!status.planRelayInstalled) settings.showPlanInNotch = false;+ if (!status.planRelayInstalled) {+ settings.showPlanInNotch = false;+ settings.showPlanInCompactIsland = false;+ }redraw();};@@ -290,6 +294,21 @@ function planSection(status: HookStatus): HTMLElement {});}});+ const swCompact = toggle(settings.showPlanInCompactIsland, (on) => {+ if (!on) {+ settings.showPlanInCompactIsland = false;+ void save();+ } else if (status.planRelayInstalled) {+ settings.showPlanInCompactIsland = true;+ void save();+ } else {+ void reviewChange(body, STATUS_LINE_CHANGE, true, () => void rebuild(), () => {+ settings.planRelayInstalled = true;+ settings.showPlanInCompactIsland = true;+ void save().then(rebuild);+ });+ }+ });body.append(h("div", {class: "hint",@@ -297,6 +316,7 @@ function planSection(status: HookStatus): HTMLElement {}),h("div", { class: "hint", text: PLAN_SETTINGS_TEXT.claudeCli }),h("div", { class: "row" }, h("label", { text: PLAN_SETTINGS_TEXT.showClaude }), sw),+ h("div", { class: "row" }, h("label", { text: PLAN_SETTINGS_TEXT.showClaudeCompact }), swCompact),h("div", { class: "row" },h("label", { text: t("Relay") }),statusDot(status.planRelayInstalled),diff --git a/windows/src/style.css b/windows/src/style.cssindex ebc40932..789da714 100644--- a/windows/src/style.css+++ b/windows/src/style.css@@ -176,6 +176,46 @@ body {transition: opacity 0.25s ease-in-out;}+/* Compact Claude plan gauge, next to the agent dots in the compact island. */+#compact-plan {+ --plan: #6b7079;+ position: absolute;+ top: 50%;+ transform: translateY(-50%);+ display: flex;+ align-items: center;+ gap: 4px;+ padding: 3px 7px;+ border: 1px solid color-mix(in srgb, var(--plan) 14%, transparent);+ border-radius: 999px;+ background: #0e0f11;+ color: var(--dim-3);+ font: 600 10px var(--font);+ font-variant-numeric: tabular-nums;+ line-height: 12px;+ white-space: nowrap;+ cursor: pointer;+ pointer-events: auto;+ opacity: 0;+ transition: opacity 0.25s ease-in-out, right 0.2s ease, background 0.18s, border-color 0.18s, color 0.18s;+ user-select: none;+ z-index: 2;+}++#compact-plan:hover {+ background: color-mix(in srgb, var(--plan) 18%, transparent);+ border-color: color-mix(in srgb, var(--plan) 55%, transparent);+ color: color-mix(in srgb, var(--plan) 70%, white);+}++#compact-plan .compact-plan-dot {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--plan);+ flex-shrink: 0;+}+/* Date and time in the middle of the compact island, between Mochi and the grid. */#island-clock {position: absolute;diff --git a/windows/src/views/usage.ts b/windows/src/views/usage.tsindex 9abc2e0b..d383339f 100644--- a/windows/src/views/usage.ts+++ b/windows/src/views/usage.ts@@ -26,15 +26,23 @@ export function claudePillVisible(): boolean {return State.view === "overview" && s.showPlanInNotch && s.planRelayInstalled;}+/** The compact island's Claude plan gauge: compact mode, turned on, relay in. */+export function claudeCompactPillVisible(): boolean {+ const s = State.settings;+ return State.mode === "compact" && s.showPlanInCompactIsland && s.planRelayInstalled;+}+/** The Codex pill is in the header: overview, turned on (nothing to install). */export function codexPillVisible(): boolean {return State.view === "overview" && State.settings.showCodexPlanInNotch;}-/** A plan card is open and its pill is still there. */+/** A plan card is open and either of its pills (header or compact) is enabled. */export function planCardOpen(): boolean {if (!State.showingPlanDetail) return false;- return State.planDetailIsCodex ? codexPillVisible() : claudePillVisible();+ if (State.planDetailIsCodex) return codexPillVisible();+ const s = State.settings;+ return State.view === "overview" && (s.showPlanInNotch || s.showPlanInCompactIsland) && s.planRelayInstalled;}const claudeColor = (now = Date.now()) => planColor(dominantPct(State.planUsage, now));diff --git a/windows/tests/plan.test.mjs b/windows/tests/plan.test.mjsindex 29b5f763..5354f8ac 100644--- a/windows/tests/plan.test.mjs+++ b/windows/tests/plan.test.mjs@@ -11,7 +11,7 @@ import {import { emit } from "./tauri.mjs";import { registerHookHandlers } from "../src/island/hooks.ts";import {- claudePillVisible, codexPillVisible, openPlanColor, planCardOpen,+ claudeCompactPillVisible, claudePillVisible, codexPillVisible, openPlanColor, planCardOpen,} from "../src/views/usage.ts";import { DEFAULT_SETTINGS, State } from "../src/core/state.ts";@@ -216,6 +216,17 @@ test("the Claude pill needs the switch and the relay, and the overview", () => {assert.equal(claudePillVisible(), false);});+test("the compact Claude pill needs compact mode, the switch and the relay", () => {+ assert.equal(claudeCompactPillVisible(), false);+ State.mode = "compact";+ State.settings.showPlanInCompactIsland = true;+ assert.equal(claudeCompactPillVisible(), false);+ State.settings.planRelayInstalled = true;+ assert.equal(claudeCompactPillVisible(), true);+ State.mode = "expanded";+ assert.equal(claudeCompactPillVisible(), false);+});+test("the Codex pill needs only its switch, on the overview", () => {State.settings.showCodexPlanInNotch = true;assert.equal(codexPillVisible(), true);@@ -238,6 +249,15 @@ test("an open card follows its pill, and Mochi wears that plan's colour", () =>assert.equal(openPlanColor(), "#F4505E");});+test("the plan card opens via compact island setting on the overview", () => {+ State.view = "overview";+ State.settings.showPlanInNotch = false;+ State.settings.showPlanInCompactIsland = true;+ State.settings.planRelayInstalled = true;+ State.showingPlanDetail = true;+ assert.equal(planCardOpen(), true);+});+test("focusing another pill closes the plan card", () => {State.loadIntegrationTasks();State.showingPlanDetail = true;