Skip to content

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.

Island: a close cross at the top right folds it to compact right away

Claudef2e7fe7560d7
diff --git a/NotchBuddy/Sources/App/ClaudePlanCardView.swift b/NotchBuddy/Sources/App/ClaudePlanCardView.swift
index cc8db39c..424445e0 100644
--- a/NotchBuddy/Sources/App/ClaudePlanCardView.swift
+++ b/NotchBuddy/Sources/App/ClaudePlanCardView.swift
@@ -4,6 +4,12 @@ import SwiftUI
struct ClaudePlanCardView: View {
let usage: PlanUsage? // nil = installed, no data yet
+ #if !APPSTORE
+ /// Claude and Codex both shown: Codex is a third row (the header has room for one pill).
+ var codexRow: Bool = false
+ var codexUsage: CodexPlanUsage? = nil
+ var onCodex: () -> Void = {}
+ #endif
@State private var now = Date()
@@ -32,6 +38,18 @@ struct ClaudePlanCardView: View {
VStack(alignment: .leading, spacing: 5) {
GaugeRowView(label: String(localized: "plan.5hours"), window: usage?.fiveHour, now: now)
GaugeRowView(label: String(localized: "plan.week"), window: usage?.sevenDay, now: now, weekly: true)
+ #if !APPSTORE
+ if codexRow {
+ // The Codex window closest to its limit; a click opens the Codex card.
+ Button(action: onCodex) {
+ let window = codexDominantWindow
+ GaugeRowView(label: "Codex", window: window, now: now,
+ weekly: window != nil && window == codexUsage?.sevenDay)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ }
+ #endif
}
.padding(.top, 8)
.padding(.leading, 108)
@@ -47,6 +65,19 @@ struct ClaudePlanCardView: View {
)
}
+ #if !APPSTORE
+ private var codexDominantWindow: PlanWindow? {
+ guard let u = codexUsage else { return nil }
+ switch (u.fiveHour, u.sevenDay) {
+ case (nil, nil): return nil
+ case (let f?, nil): return f
+ case (nil, let w?): return w
+ case (let f?, let w?):
+ return ClaudePlanGauge.effectivePct(f) >= ClaudePlanGauge.effectivePct(w) ? f : w
+ }
+ }
+ #endif
+
private var subtitleText: String {
guard let usage else { return String(localized: "plan.waiting") }
let diff = now.timeIntervalSince(usage.updatedAt)
diff --git a/NotchBuddy/Sources/App/IslandRootView.swift b/NotchBuddy/Sources/App/IslandRootView.swift
index 2d376946..4505ad0b 100644
--- a/NotchBuddy/Sources/App/IslandRootView.swift
+++ b/NotchBuddy/Sources/App/IslandRootView.swift
@@ -523,14 +523,11 @@ struct IslandContentView: View {
struct IslandHeader: View {
@ObservedObject var state: AppState
- // Claude + Codex pills together: tighten the right side so it clears the notch
- private var bothPlans: Bool {
- #if !APPSTORE
- return state.view == .overview && state.showPlanInNotch && state.planRelayInstalled && state.showCodexPlanInNotch
- #else
- return false
- #endif
- }
+ @State private var closeHovered = false
+
+ /// Pending approval or mail draft: the island refuses to fold (fsm.isHeldOpen), so the
+ /// close cross is not shown.
+ private var heldOpen: Bool { state.pendingApproval != nil || state.voiceMailDraft != nil }
var body: some View {
HStack(spacing: 0) {
@@ -551,16 +548,17 @@ struct IslandHeader: View {
Spacer()
// Right: plan pill (GitHub build, home view only) + action icons
- HStack(spacing: bothPlans ? 5 : 8) {
+ HStack(spacing: 8) {
#if !APPSTORE
+ // Claude and Codex both on: only Claude here (two pills and the icons do not
+ // clear the notch); Codex is a row in the Claude plan card.
if state.view == .overview && state.showPlanInNotch && state.planRelayInstalled {
ClaudePlanHeaderPill(state: state)
- }
- if state.view == .overview && state.showCodexPlanInNotch {
+ } else if state.view == .overview && state.showCodexPlanInNotch {
ClaudePlanHeaderPill(state: state, codex: true)
}
#endif
- HStack(spacing: bothPlans ? 10 : 14) {
+ HStack(spacing: 14) {
Button(action: {
withAnimation(.spring(response: 0.3, dampingFraction: 0.8)) {
state.view = .settings
@@ -578,9 +576,25 @@ struct IslandHeader: View {
.foregroundColor(Color(hex: "#8E939C"))
}
.buttonStyle(.plain)
+
+ // Fold back to the compact island now, without waiting for the timer.
+ if !heldOpen {
+ Button(action: {
+ NotificationCenter.default.post(name: .islandCollapse, object: nil)
+ }) {
+ Image(systemName: "xmark")
+ .font(.system(size: 12, weight: .medium))
+ .foregroundColor(Color(hex: closeHovered ? "#F5F6F8" : "#8E939C"))
+ .frame(width: 16, height: 16)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .help(String(localized: "Close"))
+ .onHover { closeHovered = $0 }
+ }
}
}
- .padding(.trailing, bothPlans ? 8 : 16)
+ .padding(.trailing, 16)
}
.frame(maxHeight: .infinity)
}
diff --git a/NotchBuddy/Sources/App/IslandViewContent.swift b/NotchBuddy/Sources/App/IslandViewContent.swift
index eda4d70d..a0585a17 100644
--- a/NotchBuddy/Sources/App/IslandViewContent.swift
+++ b/NotchBuddy/Sources/App/IslandViewContent.swift
@@ -120,7 +120,19 @@ struct OverviewView: View {
if state.planDetailIsCodex {
CodexPlanCardView(usage: state.codexPlanUsage)
} else {
- ClaudePlanCardView(usage: state.claudePlanUsage)
+ // Claude and Codex both on: the header shows only the Claude pill,
+ // Codex is a third row here that opens its own card.
+ let bothPlans = state.showPlanInNotch && state.planRelayInstalled
+ && state.showCodexPlanInNotch
+ ClaudePlanCardView(usage: state.claudePlanUsage,
+ codexRow: bothPlans,
+ codexUsage: state.codexPlanUsage,
+ onCodex: {
+ withAnimation(.spring(response: 0.28, dampingFraction: 0.82)) {
+ state.planDetailIsCodex = true
+ }
+ state.refreshCodexPlanUsage()
+ })
}
}
.transition(.opacity)