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.

Corner island: the circle and the name go smoothly, the halo moves with Mochi, a gradual magnet

Claude81cef1ca040d
diff --git a/NotchBuddy/Sources/App/CornerIsland.swift b/NotchBuddy/Sources/App/CornerIsland.swift
index 76b5fecb..e50ab32c 100644
--- a/NotchBuddy/Sources/App/CornerIsland.swift
+++ b/NotchBuddy/Sources/App/CornerIsland.swift
@@ -36,7 +36,7 @@ struct CornerArcView: View {
static let smallBody: CGFloat = 24
static let swapDuration: Double = 0.5
/// The tapped one's circle draws itself out first, this long, then the two fly.
- static let ringOutDuration: Double = 0.2
+ static let ringOutDuration: Double = 0.24
private var arcTasks: [AgentTask] {
let focus = state.focusTask?.id
@@ -121,7 +121,7 @@ struct CornerArcView: View {
if index < ids.count { ids[index] = focus.id }
// First its circle and its name go (from the top down both sides)…
pendingTap = task.id
- ringOff.insert(task.id)
+ withAnimation(.easeInOut(duration: Self.ringOutDuration)) { _ = ringOff.insert(task.id) }
SoundEngine.shared.play("blip")
DispatchQueue.main.asyncAfter(deadline: .now() + Self.ringOutDuration) {
guard pendingTap == task.id else { return }
@@ -148,7 +148,9 @@ struct CornerArcView: View {
ringOff.insert(s.outgoing.id)
}
// The one that left the corner has reached its place: its circle draws itself in.
- DispatchQueue.main.async { ringOff.remove(s.outgoing.id) }
+ DispatchQueue.main.async {
+ withAnimation(.easeOut(duration: 0.35)) { _ = ringOff.remove(s.outgoing.id) }
+ }
}
}
@@ -224,7 +226,6 @@ private struct CornerMini: View {
}
.buttonStyle(.plain)
.scaleEffect(hover ? 1.1 : 1)
- .animation(.easeInOut(duration: 0.32), value: ring)
.onHover { h in withAnimation(.spring(response: 0.2, dampingFraction: 0.7)) { hover = h } }
.help(name)
}
diff --git a/NotchBuddy/Sources/App/IslandRootView.swift b/NotchBuddy/Sources/App/IslandRootView.swift
index bc74e81b..16de6a70 100644
--- a/NotchBuddy/Sources/App/IslandRootView.swift
+++ b/NotchBuddy/Sources/App/IslandRootView.swift
@@ -399,6 +399,9 @@ struct BotPlacement: View {
.blur(radius: 6)
.opacity(botGlowOpacity(state.effectiveState))
.position(x: cx, y: cy)
+ // The same spring as Mochi: the halo stays on him while he moves.
+ .animation(.spring(response: 0.5, dampingFraction: damping), value: cx)
+ .animation(.spring(response: 0.5, dampingFraction: damping), value: cy)
.animation(.easeInOut(duration: 0.4), value: state.effectiveState)
}
diff --git a/NotchBuddy/Sources/App/IslandWindowController.swift b/NotchBuddy/Sources/App/IslandWindowController.swift
index 11df9f45..5abfd2e3 100644
--- a/NotchBuddy/Sources/App/IslandWindowController.swift
+++ b/NotchBuddy/Sources/App/IslandWindowController.swift
@@ -61,6 +61,7 @@ final class IslandWindowController: NSWindowController {
/// While Mochi is dragged near a corner (or the top centre): the place he will take.
private var snapPanel: NSPanel? = nil
private var snapShown: IslandPlacement? = nil
+ private var lastGhostTick: CFTimeInterval = 0
private var highlightWindowPid: pid_t = 0
// Notch real dimensions (set on init)
@@ -416,6 +417,8 @@ final class IslandWindowController: NSWindowController {
// is elsewhere, so a hidden island costs next to nothing (CLAUDE.md: 0 % CPU when hidden).
private static let fastPoll: TimeInterval = 1.0 / 60.0
+ /// Mochi held by the pointer: 120 Hz, so he glides on a ProMotion screen.
+ private static let dragPoll: TimeInterval = 1.0 / 120.0
private static let nearPoll: TimeInterval = 1.0 / 20.0
private static let idlePoll: TimeInterval = 1.0 / 8.0
private var pollInterval: TimeInterval = 0
@@ -452,7 +455,7 @@ final class IslandWindowController: NSWindowController {
// only near the island. 60 Hz while open, dragging or close to it.
let busy = state.mode == .expanded || inAttachDrag || attachDragStart != nil
|| fsm.state == .home || fsm.state == .coucou || fsm.state == .listening || nearIsland
- let wanted = busy ? Self.fastPoll : inBand ? Self.nearPoll : Self.idlePoll
+ let wanted = inAttachDrag ? Self.dragPoll : busy ? Self.fastPoll : inBand ? Self.nearPoll : Self.idlePoll
if wanted != pollInterval { startPolling(interval: wanted) }
}
@@ -1126,6 +1129,7 @@ final class IslandWindowController: NSWindowController {
// He leaves from where he is, then glides to the pointer (updateDragGhost).
let from = botScreenCenter() ?? mouse
ghostCurrentOrigin = NSPoint(x: from.x - s/2, y: from.y - s/2)
+ lastGhostTick = CACurrentMediaTime()
let panel = NSPanel(
contentRect: NSRect(x: ghostCurrentOrigin.x, y: ghostCurrentOrigin.y, width: s, height: s),
@@ -1173,24 +1177,28 @@ final class IslandWindowController: NSWindowController {
guard let panel = dragGhostPanel else { return }
let s = dragGhostSize
let mouse = NSEvent.mouseLocation
+ let now = CACurrentMediaTime()
+ let dt = min(0.05, max(0.001, now - lastGhostTick))
+ lastGhostTick = now
+ var target = NSPoint(x: mouse.x - s/2, y: mouse.y - s/2)
#if !APPSTORE
- // Near a corner (or the top centre): the place shows, and Mochi is pulled into it.
+ // Near a corner (or the top centre): the place shows, and the nearer the pointer gets,
+ // the harder Mochi is pulled into it (a gradual magnet, no jump at the zone's edge).
if let snap = snapTarget(at: mouse) {
let rect = snap.1
showSnapTarget(snap.0, rect: rect)
- let c = NSPoint(x: rect.midX - s/2, y: rect.midY - s/2)
- let k: CGFloat = 0.35
- ghostCurrentOrigin = NSPoint(x: ghostCurrentOrigin.x + (c.x - ghostCurrentOrigin.x) * k,
- y: ghostCurrentOrigin.y + (c.y - ghostCurrentOrigin.y) * k)
- panel.setFrameOrigin(ghostCurrentOrigin)
- return
+ let d = hypot(mouse.x - rect.midX, mouse.y - rect.midY)
+ let x = max(0, min(1, 1 - (d - 20) / IslandPlacement.snapDistance))
+ let w = x * x * (3 - 2 * x)
+ target = NSPoint(x: target.x + (rect.midX - s/2 - target.x) * w,
+ y: target.y + (rect.midY - s/2 - target.y) * w)
+ } else {
+ showSnapTarget(nil)
}
- showSnapTarget(nil)
#endif
- // Held: he catches up with the pointer in a few frames (no jump when he leaves the
- // island or a corner's place), then follows it closely.
- let target = NSPoint(x: mouse.x - s/2, y: mouse.y - s/2)
- let k: CGFloat = 0.4
+ // Eased towards the target, the same however fast the screen refreshes: he catches up
+ // with the pointer in a few frames (no jump), then follows it closely.
+ let k = CGFloat(1 - exp(-dt / 0.045))
ghostCurrentOrigin = NSPoint(x: ghostCurrentOrigin.x + (target.x - ghostCurrentOrigin.x) * k,
y: ghostCurrentOrigin.y + (target.y - ghostCurrentOrigin.y) * k)
panel.setFrameOrigin(ghostCurrentOrigin)