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
Android Widgets: shorter Mochi Big description, one-line offline Alert, debug usage preview
Claude15bbe186f4cf
diff --git a/android/app/src/debug/kotlin/com/coucou/android/app/WidgetPreviewReceiver.kt b/android/app/src/debug/kotlin/com/coucou/android/app/WidgetPreviewReceiver.ktindex 96790478..e8358464 100644--- a/android/app/src/debug/kotlin/com/coucou/android/app/WidgetPreviewReceiver.kt+++ b/android/app/src/debug/kotlin/com/coucou/android/app/WidgetPreviewReceiver.kt@@ -19,12 +19,18 @@ import com.coucou.android.core.WidgetSample* adb shell am broadcast -n com.coucou.android/.app.WidgetPreviewReceiver -a com.coucou.android.debug.WIDGET_STATE --es state done* adb shell am broadcast -n com.coucou.android/.app.WidgetPreviewReceiver -a com.coucou.android.debug.WIDGET_STATE --es state live*+ * Optional `--ei usage <percent>` sets Claude's plan usage on Mochi Big and the Usage Ring (reset in 2 h), to see the near-limit look+ * (red from 90, large rate, "Near limit", reset time). Without `--es state` it uses `working`; ignored for `disconnected` and `live`:+ *+ * adb shell am broadcast -n com.coucou.android/.app.WidgetPreviewReceiver -a com.coucou.android.debug.WIDGET_STATE --es state working --ei usage 92+ ** `live` goes back to the real state. A chosen state stays on the Widgets (real changes wait) until `live` or until the app* process is killed. The states are made up by [WidgetSample]; nothing is read from, or sent to, a computer.*/class WidgetPreviewReceiver : BroadcastReceiver() {override fun onReceive(context: Context, intent: Intent) {- val key = intent.getStringExtra("state")?.trim()?.lowercase()+ val usage = if (intent.hasExtra("usage")) intent.getIntExtra("usage", 0) else null+ val key = intent.getStringExtra("state")?.trim()?.lowercase() ?: if (usage != null) "working" else nullif (key == "live") {WidgetHub.preview(context, null)return@@ -34,6 +40,6 @@ class WidgetPreviewReceiver : BroadcastReceiver() {Log.w("CoucouWidgets", "unknown state '$key': use disconnected, empty, working, waiting, done or live")return}- WidgetHub.preview(context, WidgetData.sample(sample, System.currentTimeMillis()))+ WidgetHub.preview(context, WidgetData.sample(sample, System.currentTimeMillis(), usage))}}diff --git a/android/app/src/main/kotlin/com/coucou/android/core/WidgetData.kt b/android/app/src/main/kotlin/com/coucou/android/core/WidgetData.ktindex 81bea6bc..1cb030e7 100644--- a/android/app/src/main/kotlin/com/coucou/android/core/WidgetData.kt+++ b/android/app/src/main/kotlin/com/coucou/android/core/WidgetData.kt@@ -181,7 +181,7 @@ data class WidgetContent(/** The line under the alert: who is waiting, or why there is nothing to say. */val alertSub: String get() = when {- !connected -> "Waiting for your computer"+ !connected -> "Waiting for your PC"waiting > 0 -> top?.name.orEmpty()else -> "Nothing needs you"}@@ -268,8 +268,11 @@ object WidgetData {}}- /** The content a [WidgetSample] stands for, built like a real one. [nowMs] only sets when the sample plan windows reset. */- fun sample(which: WidgetSample, nowMs: Long = 0L): WidgetContent {+ /**+ * The content a [WidgetSample] stands for, built like a real one. [nowMs] only sets when the sample plan windows reset.+ * [usagePct], when given, replaces Claude's five-hour usage (Mochi Big and the Usage Ring); null keeps the sample's own.+ */+ fun sample(which: WidgetSample, nowMs: Long = 0L, usagePct: Int? = null): WidgetContent {val link = if (which == WidgetSample.DISCONNECTED) LinkState.DISCONNECTED else LinkState.CONNECTEDval sessions = when (which) {WidgetSample.DISCONNECTED, WidgetSample.EMPTY -> emptyList()@@ -294,7 +297,10 @@ object WidgetData {fun plan(five: Int, week: Int) = PlanUsage(PlanWindow(five, nowMs + 2 * HOUR_MS), PlanWindow(week, nowMs + 3 * 24 * HOUR_MS))// Codex has only its week here, so the second row of Mochi Big reads "Codex · week".fun week(pct: Int) = PlanUsage(null, PlanWindow(pct, nowMs + 3 * 24 * HOUR_MS))- val usage = when (which) {+ val usage = if (usagePct != null && which != WidgetSample.DISCONNECTED) {+ // Debug preview of the near-limit look: Claude's five-hour window at [usagePct], reset in two hours; Codex stays as in the sample.+ UsageSnapshot(plan(usagePct, usagePct * 2 / 3), week(41))+ } else when (which) {WidgetSample.WORKING -> UsageSnapshot(plan(42, 18), week(41))WidgetSample.WAITING -> UsageSnapshot(plan(83, 61), week(93))WidgetSample.DONE -> UsageSnapshot(plan(24, 9), null)diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xmlindex 04ce9e4f..f97abb64 100644--- a/android/app/src/main/res/values/strings.xml+++ b/android/app/src/main/res/values/strings.xml@@ -19,7 +19,7 @@<string name="widget_mochi_description">Mochi, %1$s</string><string name="widget_badge_description">%1$d waiting for you</string><string name="widget_big_label">Mochi, big</string>- <string name="widget_big_description">A big Mochi that says what your agent is doing.</string>+ <string name="widget_big_description">Mochi, your plan usage and quick buttons.</string><string name="widget_pill_label">One-line status</string><string name="widget_pill_description">Your most urgent agent on one line.</string><string name="widget_alert_label">Approvals waiting</string>diff --git a/android/app/src/test/kotlin/com/coucou/android/WidgetSampleTest.kt b/android/app/src/test/kotlin/com/coucou/android/WidgetSampleTest.ktindex 76cf71f7..84175c51 100644--- a/android/app/src/test/kotlin/com/coucou/android/WidgetSampleTest.kt+++ b/android/app/src/test/kotlin/com/coucou/android/WidgetSampleTest.kt@@ -1,5 +1,6 @@package com.coucou.android+import com.coucou.android.core.UsageToneimport com.coucou.android.core.WidgetDataimport com.coucou.android.core.WidgetSampleimport com.coucou.android.core.WidgetTone@@ -50,6 +51,23 @@ class WidgetSampleTest {assertEquals(3, c.today)}+ @Test fun theUsageOverrideShowsTheNearLimitLook() {+ val now = 1_000_000L+ val c = WidgetData.sample(WidgetSample.WORKING, now, 92)+ assertEquals(92, c.ring?.pct)+ assertEquals(UsageTone.LIMIT, c.ring?.tone)+ assertEquals("Near limit · resets in 2 h", c.ring?.note)+ assertEquals(92, c.usageRows.first().pct)+ assertEquals("Claude", c.usageRows.first().plan)+ assertEquals(null, WidgetData.sample(WidgetSample.WORKING, now, 60).ring?.note)+ assertEquals(WidgetData.sample(WidgetSample.WORKING, now), WidgetData.sample(WidgetSample.WORKING, now, null))+ assertEquals(null, WidgetData.sample(WidgetSample.DISCONNECTED, now, 92).ring)+ }++ @Test fun theDisconnectedAlertFitsOneLine() {+ assertEquals("Waiting for your PC", sample(WidgetSample.DISCONNECTED).alertSub)+ }+@Test fun waiting() {val c = sample(WidgetSample.WAITING)assertEquals(WidgetTone.ATTENTION, c.look)diff --git a/android/app/src/test/kotlin/com/coucou/android/WidgetSurfacesTest.kt b/android/app/src/test/kotlin/com/coucou/android/WidgetSurfacesTest.ktindex bb4e00ae..9720d7c4 100644--- a/android/app/src/test/kotlin/com/coucou/android/WidgetSurfacesTest.kt+++ b/android/app/src/test/kotlin/com/coucou/android/WidgetSurfacesTest.kt@@ -188,6 +188,7 @@ class WidgetSurfacesTest {}assertTrue(src.contains("adb shell am broadcast -n com.coucou.android/.app.WidgetPreviewReceiver -a com.coucou.android.debug.WIDGET_STATE"))assertTrue(src.contains("DEBUG BUILDS ONLY"))+ assertTrue(src.contains("--ei usage 92"))// It only redraws Widgets with a made-up state.assertTrue(src.contains("WidgetSample.parse"))for (word in listOf("PendingLaunch", "approve", "AppModel", "SecureStore")) assertFalse(word, src.contains(word))diff --git a/android/i18n/app-strings.json b/android/i18n/app-strings.jsonindex b986e4d1..9a0b21c3 100644--- a/android/i18n/app-strings.json+++ b/android/i18n/app-strings.json@@ -19,7 +19,7 @@"widget_mochi_description": "Mochi, %1$s","widget_badge_description": "%1$d waiting for you","widget_big_label": "Mochi, big",- "widget_big_description": "A big Mochi that says what your agent is doing.",+ "widget_big_description": "Mochi, your plan usage and quick buttons.","widget_pill_label": "One-line status","widget_pill_description": "Your most urgent agent on one line.","widget_alert_label": "Approvals waiting",