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
Smoother: display-rate drop zone, gliding countdown bar, eye tracking on every mouse move
Claudeb5b04c2844f5
diff --git a/NotchBuddy/Sources/App/IslandRootView.swift b/NotchBuddy/Sources/App/IslandRootView.swiftindex 6dadd930..2d376946 100644--- a/NotchBuddy/Sources/App/IslandRootView.swift+++ b/NotchBuddy/Sources/App/IslandRootView.swift@@ -463,10 +463,13 @@ struct CountdownBar: View {let window = min(10.0, autoClose * 0.6)let elapsed = Date.now.timeIntervalSince(state.lastActivity)let remaining = autoClose - elapsed- if remaining < window {- barWidth = max(0, CGFloat(remaining / window) * 160)- } else {- barWidth = 0+ let target: CGFloat = remaining < window ? max(0, CGFloat(remaining / window) * 160) : 0+ // The timer ticks at 10 Hz; a linear animation over the same 0.1 s glides between ticks,+ // so the bar shrinks on every display frame instead of in 10 steps a second.+ if target < barWidth && barWidth - target < 40 {+ withAnimation(.linear(duration: 0.1)) { barWidth = target }+ } else if target != barWidth {+ barWidth = target}}}diff --git a/NotchBuddy/Sources/App/IslandViewContent.swift b/NotchBuddy/Sources/App/IslandViewContent.swiftindex 83153473..eda4d70d 100644--- a/NotchBuddy/Sources/App/IslandViewContent.swift+++ b/NotchBuddy/Sources/App/IslandViewContent.swift@@ -811,12 +811,8 @@ struct ConfusedView: View {struct UploadView: View {@ObservedObject var state: AppState- @State private var dashPhase: CGFloat = 0- @State private var breathAngle: Double = 0- // Timer only runs while this is the active tab — killed on deactivation- @State private var animTimer: Timer? = nil- private var borderOpacity: Double {+ private func borderOpacity(breathAngle: Double) -> Double {let breathe = 0.11 + 0.04 * (sin(breathAngle) * 0.5 + 0.5)return state.fileDragOver ? 0.65 : breathe}@@ -825,13 +821,21 @@ struct UploadView: View {ZStack {RoundedRectangle(cornerRadius: 20).fill(Color(hex: "#0E0F11"))- RoundedRectangle(cornerRadius: 20)- .stroke(- state.fileDragOver- ? Color(hex: "#22C55E").opacity(borderOpacity)- : Color.white.opacity(borderOpacity),- style: StrokeStyle(lineWidth: 1.5, dash: [6, 5], dashPhase: dashPhase)- )+ // The dashes march at 20 pt/s and the border breathes at 0.9 rad/s, computed from the+ // clock on every display frame (it was a 20 Hz timer, visibly stepped). Runs only while+ // this is the open view.+ TimelineView(.animation(paused: state.view != .upload || state.mode != .expanded)) { tl in+ let t = tl.date.timeIntervalSinceReferenceDate+ let dashPhase = CGFloat((t * 20).truncatingRemainder(dividingBy: 11))+ let opacity = borderOpacity(breathAngle: t * 0.9)+ RoundedRectangle(cornerRadius: 20)+ .stroke(+ state.fileDragOver+ ? Color(hex: "#22C55E").opacity(opacity)+ : Color.white.opacity(opacity),+ style: StrokeStyle(lineWidth: 1.5, dash: [6, 5], dashPhase: dashPhase)+ )+ }RoundedRectangle(cornerRadius: 20).fill(RadialGradient(colors: [Color(hex: "#22C55E").opacity(state.fileDragOver ? 0.13 : 0), Color.clear],@@ -855,27 +859,6 @@ struct UploadView: View {.padding(.leading, 196).frame(maxWidth: .infinity, alignment: .leading)}- .onChange(of: state.view) { _, newView in- newView == .upload ? startTimer() : stopTimer()- }- .onAppear {- if state.view == .upload { startTimer() }- }- .onDisappear { stopTimer() }- }-- private func startTimer() {- guard animTimer == nil else { return }- // 20 fps — smooth enough for slow dash, 3× lighter than 60fps- animTimer = Timer.scheduledTimer(withTimeInterval: 1.0/20.0, repeats: true) { _ in- dashPhase += 1.0 // 20 pt/s march- breathAngle += 0.9 / 20.0 // advance sin phase at 0.9 rad/s- }- }-- private func stopTimer() {- animTimer?.invalidate()- animTimer = nil}}diff --git a/NotchBuddy/Sources/App/IslandWindowController.swift b/NotchBuddy/Sources/App/IslandWindowController.swiftindex fabe7173..9cf3f68d 100644--- a/NotchBuddy/Sources/App/IslandWindowController.swift+++ b/NotchBuddy/Sources/App/IslandWindowController.swift@@ -904,6 +904,17 @@ final class IslandWindowController: NSWindowController {self?.handleDizzy()}+ // Eye tracking at the mouse's own rate: Mochi's look target follows every mouse move+ // instead of the island poll (8 to 20 Hz away from the island, which made the head step).+ // Nothing runs while the mouse is still, and a hidden island skips the work.+ NSEvent.addGlobalMonitorForEvents(matching: [.mouseMoved, .leftMouseDragged]) { _ in+ MainActor.assumeIsolated { IslandWindowController.trackMouseLook() }+ }+ NSEvent.addLocalMonitorForEvents(matching: [.mouseMoved, .leftMouseDragged]) { event in+ MainActor.assumeIsolated { IslandWindowController.trackMouseLook() }+ return event+ }+// Window attach drag.// Uses MainActor.assumeIsolated (synchronous) to avoid race with pollFrame().// Global mouseUp is the reliable fallback when cursor is outside our panel frame.@@ -1332,6 +1343,15 @@ final class IslandWindowController: NSWindowController {/// Top of the menu-bar screen in AppKit coordinates: origin of `DesktopSpace`.static var desktopTop: CGFloat { NSScreen.screens.first?.frame.maxY ?? 0 }+ /// Mochi's look target from the current mouse position (see the mouse-moved monitors).+ static func trackMouseLook() {+ let app = AppState.shared+ guard app.mode != .hidden || app.mochiOnDesktop else { return }+ let pos = DesktopSpace.topDown(NSEvent.mouseLocation, desktopTop: desktopTop)+ let cur = app.mousePosition+ if abs(pos.x - cur.x) > 1 || abs(pos.y - cur.y) > 1 { app.mousePosition = pos }+ }+/// Screen the island currently sits on (Settings window, desktop Mochi flights).private(set) static var currentScreen: NSScreen?