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
Coucou window: the pages in one big card, Mochis living at the top of each page
Claude7bc7574a34dc
diff --git a/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj b/NotchBuddy/NotchBuddy.xcodeproj/project.pbxprojindex bea1fb68..7aa0758d 100644--- a/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj+++ b/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj@@ -47,6 +47,7 @@1C2BB61FA83015C42B321E0E /* PillColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37564F5F041B38C976DF3DEF /* PillColors.swift */; };1D23613B270FE8B11C5E27A7 /* IslandDisplayChoice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A09E73F1E58019EF6EA2A62 /* IslandDisplayChoice.swift */; };1D4CE0CCD2B5A0FFE50C7F06 /* TerminalTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87AF6F7A027AB1D46309DD49 /* TerminalTarget.swift */; };+ 8885D645C2235B74ACFFBD5C /* FlowHubMochis.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDA206D2358F698DD382DA32 /* FlowHubMochis.swift */; };C25D058C2C5B4B7A93238F3A /* NoteTaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A6EB483F6EC87C05CC6C69 /* NoteTaker.swift */; };AA4B80F3F49E23FED830EC7D /* NoteAudio.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2BE0A486C4ED7BEDDC96548 /* NoteAudio.swift */; };A52241F5F37D87CB9BB8E4E0 /* NoteModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66BB44A1EDFFD50C0688BD09 /* NoteModels.swift */; };@@ -146,6 +147,7 @@65CB53E20B2289CA3AC3E8FE /* TurnSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A1C4152EBDBD7C24CABFFD7 /* TurnSnapshot.swift */; };6613EB914852E6EEB1FF37BF /* IntentParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39753CFF90B494D449CCD95 /* IntentParser.swift */; };6726F74966EDE7F82BFE89B2 /* TerminalTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87AF6F7A027AB1D46309DD49 /* TerminalTarget.swift */; };+ C839C6CBE10ADE51BBC9D954 /* FlowHubMochis.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDA206D2358F698DD382DA32 /* FlowHubMochis.swift */; };BAFE1A37B0ACEFDCE29E2B1E /* NoteTaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A6EB483F6EC87C05CC6C69 /* NoteTaker.swift */; };B42017CDFF5A9ED72E2FF99B /* NoteAudio.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2BE0A486C4ED7BEDDC96548 /* NoteAudio.swift */; };ACC4A6ED5F5915F5B0DE9DD6 /* NoteModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66BB44A1EDFFD50C0688BD09 /* NoteModels.swift */; };@@ -499,6 +501,7 @@871CA2BADC67D97C97C7009D /* error.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = error.wav; sourceTree = "<group>"; };8790ACE9F73BD74640A0F20C /* LocalChat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalChat.swift; sourceTree = "<group>"; };87AF6F7A027AB1D46309DD49 /* TerminalTarget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalTarget.swift; sourceTree = "<group>"; };+ EDA206D2358F698DD382DA32 /* FlowHubMochis.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlowHubMochis.swift; sourceTree = "<group>"; };91A6EB483F6EC87C05CC6C69 /* NoteTaker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteTaker.swift; sourceTree = "<group>"; };D2BE0A486C4ED7BEDDC96548 /* NoteAudio.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteAudio.swift; sourceTree = "<group>"; };66BB44A1EDFFD50C0688BD09 /* NoteModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteModels.swift; sourceTree = "<group>"; };@@ -684,6 +687,7 @@914A792788D403F836BEB570 /* SpotifyViews.swift */,2EF78999D68D56ADE4CEFBE2 /* StripePoller.swift */,87AF6F7A027AB1D46309DD49 /* TerminalTarget.swift */,+ EDA206D2358F698DD382DA32 /* FlowHubMochis.swift */,91A6EB483F6EC87C05CC6C69 /* NoteTaker.swift */,D2BE0A486C4ED7BEDDC96548 /* NoteAudio.swift */,66BB44A1EDFFD50C0688BD09 /* NoteModels.swift */,@@ -1191,6 +1195,7 @@1558BB00C530B721172F6E65 /* StripePoller.swift in Sources */,9EA178EA395B116336C1FA10 /* TerminalTarget+AppKit.swift in Sources */,1D4CE0CCD2B5A0FFE50C7F06 /* TerminalTarget.swift in Sources */,+ 8885D645C2235B74ACFFBD5C /* FlowHubMochis.swift in Sources */,C25D058C2C5B4B7A93238F3A /* NoteTaker.swift in Sources */,AA4B80F3F49E23FED830EC7D /* NoteAudio.swift in Sources */,A52241F5F37D87CB9BB8E4E0 /* NoteModels.swift in Sources */,@@ -1411,6 +1416,7 @@E4B9986674F4D425826F15A8 /* StripePoller.swift in Sources */,11F14DB97C93CF84DF9D5C43 /* TerminalTarget+AppKit.swift in Sources */,6726F74966EDE7F82BFE89B2 /* TerminalTarget.swift in Sources */,+ C839C6CBE10ADE51BBC9D954 /* FlowHubMochis.swift in Sources */,BAFE1A37B0ACEFDCE29E2B1E /* NoteTaker.swift in Sources */,B42017CDFF5A9ED72E2FF99B /* NoteAudio.swift in Sources */,ACC4A6ED5F5915F5B0DE9DD6 /* NoteModels.swift in Sources */,diff --git a/NotchBuddy/Resources/Localizable.xcstrings b/NotchBuddy/Resources/Localizable.xcstringsindex 8921eb9b..f1499117 100644--- a/NotchBuddy/Resources/Localizable.xcstrings+++ b/NotchBuddy/Resources/Localizable.xcstrings@@ -3325,6 +3325,461 @@}}},+ "hub.notch.agents" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Claude Code وCodex وبقية الوكلاء الذين يتابعهم موتشي."+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Claude Code, Codex আর অন্য এজেন্ট যাদের মোচি অনুসরণ করে।"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Claude Code, Codex and the other agents Mochi follows."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Claude Code, Codex y los demás agentes que sigue Mochi."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Claude Code, Codex et les autres agents que Mochi suit."+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Claude Code, Codex और बाकी एजेंट जिन पर मोची नज़र रखता है।"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Claude Code, Codex, dan agen lain yang diikuti Mochi."+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Claude Code, Codex e os outros agentes que o Mochi acompanha."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Claude Code, Codex и другие агенты, за которыми следит Мочи."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mochi 关注的 Claude Code、Codex 和其他智能体。"+ }+ }+ }+ },+ "hub.notch.chat" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ذكاء دردشة النوتش، بمفاتيحك الخاصة."+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "নচ চ্যাটের AI, আপনার নিজের কী দিয়ে।"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "The AI of the notch's chat, with your own keys."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "La IA del chat del notch, con tus propias claves."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "L'IA du chat du notch, avec tes propres clés."+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "नॉच चैट का AI, आपकी अपनी कुंजियों से।"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "AI untuk obrolan notch, dengan kuncimu sendiri."+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "A IA do chat do notch, com suas próprias chaves."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ИИ для чата в чёлке, с вашими ключами."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "刘海聊天使用的 AI,用你自己的密钥。"+ }+ }+ }+ },+ "hub.notch.general" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "موتشي وأصواته وسلوك النوتش."+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "মোচি, তার শব্দ আর নচের আচরণ।"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mochi, his sounds and how the notch behaves."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mochi, sus sonidos y cómo se comporta el notch."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mochi, ses sons et le comportement du notch."+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "मोची, उसकी आवाज़ें और नॉच का व्यवहार।"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mochi, suaranya, dan perilaku notch."+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Mochi, seus sons e o comportamento do notch."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Мочи, его звуки и поведение чёлки."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mochi、它的声音和刘海的行为。"+ }+ }+ }+ },+ "hub.notch.integrations" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stripe وGitHub وVercel وn8n وNotion وغيرها."+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stripe, GitHub, Vercel, n8n, Notion আর বাকিগুলো।"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stripe, GitHub, Vercel, n8n, Notion and the rest."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stripe, GitHub, Vercel, n8n, Notion y los demás."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stripe, GitHub, Vercel, n8n, Notion et les autres."+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stripe, GitHub, Vercel, n8n, Notion और बाकी।"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stripe, GitHub, Vercel, n8n, Notion, dan lainnya."+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stripe, GitHub, Vercel, n8n, Notion e os outros."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stripe, GitHub, Vercel, n8n, Notion и другие."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stripe、GitHub、Vercel、n8n、Notion 等。"+ }+ }+ }+ },+ "hub.notch.pills" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "الحبوب الظاهرة في النوتش وترتيبها وألوانها."+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "নচে দেখানো পিল, তাদের ক্রম আর রং।"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "The pills shown in the notch, their order and their colours."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Las píldoras del notch, su orden y sus colores."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Les pilules affichées dans le notch, leur ordre et leurs couleurs."+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "नॉच में दिखने वाली पिल्स, उनका क्रम और रंग।"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pil di notch, urutan dan warnanya."+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "As pílulas do notch, sua ordem e suas cores."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Пилюли в чёлке, их порядок и цвета."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "刘海中显示的胶囊、顺序和颜色。"+ }+ }+ }+ },+ "hub.notch.shortcuts" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "المفاتيح التي تفتح النوتش وإجراءاته."+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "নচ আর তার কাজ খোলার কী।"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "The keys that open the notch and its actions."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Las teclas que abren el notch y sus acciones."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Les touches qui ouvrent le notch et ses actions."+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "नॉच और उसकी क्रियाएँ खोलने वाली कुंजियाँ।"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Tombol untuk membuka notch dan aksinya."+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "As teclas que abrem o notch e suas ações."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Клавиши, открывающие чёлку и её действия."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "打开刘海及其操作的按键。"+ }+ }+ }+ },+ "hub.notch.voice" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "«OK Coucou» وصوت موتشي ومفتاح الإملاء."+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "“OK Coucou”, মোচির কণ্ঠ আর ডিক্টেশন কী।"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "« OK Coucou », Mochi's voice and the dictation key."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "«OK Coucou», la voz de Mochi y la tecla de dictado."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "« OK Coucou », la voix de Mochi et la touche de dictée."+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "“OK Coucou”, मोची की आवाज़ और डिक्टेशन कुंजी।"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "“OK Coucou”, suara Mochi, dan tombol dikte."+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "“OK Coucou”, a voz do Mochi e a tecla de ditado."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "«OK Coucou», голос Мочи и клавиша диктовки."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "“OK Coucou”、Mochi 的声音和听写按键。"+ }+ }+ }+ },"hub.notes-promo" : {"extractionState" : "manual","localizations" : {diff --git a/NotchBuddy/Sources/App/FlowHub.swift b/NotchBuddy/Sources/App/FlowHub.swiftindex fb811e1e..484a3936 100644--- a/NotchBuddy/Sources/App/FlowHub.swift+++ b/NotchBuddy/Sources/App/FlowHub.swift@@ -73,10 +73,12 @@ enum HubPage: String, CaseIterable, Identifiable {/// The colors of the Coucou Flow window: the island's dark, with Coucou's orange.enum HubTheme {- static let window = Color(hex: "#0E0F11")+ static let window = Color(hex: "#0A0B0D")static let sidebar = Color(hex: "#0A0B0D")- static let card = Color(hex: "#141518")- static let field = Color(hex: "#1A1B1F")+ /// The big card on the right, where the pages are.+ static let panel = Color(hex: "#111215")+ static let card = Color(hex: "#18191C")+ static let field = Color(hex: "#1F2024")static let line = Color.white.opacity(0.07)static let text = Color(hex: "#F5F6F8")static let body = Color(hex: "#E1E3E6")@@ -92,6 +94,34 @@ enum HubTheme {static func speaker(_ index: Int) -> Color { speakers[max(0, index) % speakers.count] }}+private struct HubPageKey: EnvironmentKey {+ static let defaultValue: HubPage = .dictation+}++extension EnvironmentValues {+ /// The page shown, for the colour and the Mochis of its top band.+ var hubPage: HubPage {+ get { self[HubPageKey.self] }+ set { self[HubPageKey.self] = newValue }+ }+}++extension HubPage {+ /// The line under the title of the notch's pages.+ static func notchSubtitle(_ page: HubPage) -> String? {+ switch page {+ case .general: return String(localized: "hub.notch.general")+ case .pills: return String(localized: "hub.notch.pills")+ case .agents: return String(localized: "hub.notch.agents")+ case .chat: return String(localized: "hub.notch.chat")+ case .integrations: return String(localized: "hub.notch.integrations")+ case .voice: return String(localized: "hub.notch.voice")+ case .shortcuts: return String(localized: "hub.notch.shortcuts")+ default: return nil+ }+ }+}+@MainActorfinal class HubRouter: ObservableObject {@Published var page: HubPage = .dictation@@ -103,6 +133,7 @@ final class HubRouter: ObservableObject {final class FlowHubController {static let shared = FlowHubController()let router = HubRouter()+ let windowState = HubWindowState()private var window: NSWindow?static let showInDockKey = "coucouShowInDock"@@ -149,8 +180,9 @@ final class FlowHubController {win.titlebarAppearsTransparent = truewin.titleVisibility = .hiddenwin.appearance = NSAppearance(named: .darkAqua)- win.backgroundColor = NSColor(red: 0x0E / 255, green: 0x0F / 255, blue: 0x11 / 255, alpha: 1)- win.contentView = NSHostingView(rootView: FlowHubView(router: router))+ win.backgroundColor = NSColor(red: 0x0A / 255, green: 0x0B / 255, blue: 0x0D / 255, alpha: 1)+ win.contentView = NSHostingView(rootView: FlowHubView(router: router, windowState: windowState))+ windowState.watch(win)win.contentMinSize = NSSize(width: 940, height: 600)win.isReleasedWhenClosed = falsewin.setFrameAutosaveName("CoucouFlowWindow")@@ -163,18 +195,31 @@ final class FlowHubController {struct FlowHubView: View {@ObservedObject var router: HubRouter+ @ObservedObject var windowState: HubWindowStatevar body: some View {HStack(spacing: 0) {HubSidebar(router: router)+ // The pages sit in one big card, like Wispr Flow's window.page.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)- .background(HubTheme.window)+ .background(+ RoundedRectangle(cornerRadius: 20, style: .continuous)+ .fill(LinearGradient(colors: [Color(hex: "#141518"), HubTheme.panel],+ startPoint: .top, endPoint: .bottom))+ )+ .clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous))+ .overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).strokeBorder(Color.white.opacity(0.07)))+ .padding(.top, 10)+ .padding(.bottom, 10)+ .padding(.trailing, 10)}.background(HubTheme.window).foregroundColor(HubTheme.text).preferredColorScheme(.dark).tint(HubTheme.accent)+ .environment(\.hubVisible, windowState.visible)+ .environment(\.hubPage, router.page)}@ViewBuilder private var page: some View {@@ -188,8 +233,13 @@ struct FlowHubView: View {case .settings: HubSettingsPage()default:if let section = router.page.settingsSection {- SettingsView(embeddedSection: section)- .id(section)+ VStack(alignment: .leading, spacing: 0) {+ HubHero(page: router.page, title: router.page.title, subtitle: HubPage.notchSubtitle(router.page))+ .padding(.horizontal, 28)+ .padding(.top, 24)+ SettingsView(embeddedSection: section)+ .id(section)+ }}}}@@ -204,7 +254,7 @@ private struct HubSidebar: View {var body: some View {VStack(alignment: .leading, spacing: 3) {HStack(spacing: 10) {- HubMochi(size: 28)+ HubLiveMochi(size: 28)Text(verbatim: "Coucou").font(.system(size: 18, weight: .bold))}@@ -328,29 +378,17 @@ struct HubPageScaffold<Trailing: View, Content: View>: View {@ViewBuilder var trailing: () -> Trailing@ViewBuilder var content: () -> Content+ @Environment(\.hubPage) private var page+var body: some View {ScrollView {VStack(alignment: .leading, spacing: 22) {- HStack(alignment: .bottom, spacing: 16) {- VStack(alignment: .leading, spacing: 6) {- Text(title)- .font(.system(size: 28, weight: .bold))- .tracking(-0.5)- if let subtitle {- Text(subtitle)- .font(.system(size: 14))- .foregroundColor(HubTheme.secondary)- .fixedSize(horizontal: false, vertical: true)- }- }- Spacer(minLength: 0)- trailing()- }+ HubHero(page: page, title: title, subtitle: subtitle, trailing: trailing)content()}- .padding(.horizontal, 40)- .padding(.top, 38)- .padding(.bottom, 32)+ .padding(.horizontal, 28)+ .padding(.top, 24)+ .padding(.bottom, 28).frame(maxWidth: 1100, alignment: .leading)}.scrollIndicators(.automatic)diff --git a/NotchBuddy/Sources/App/FlowHubHome.swift b/NotchBuddy/Sources/App/FlowHubHome.swiftindex 69f7f9aa..893b17e2 100644--- a/NotchBuddy/Sources/App/FlowHubHome.swift+++ b/NotchBuddy/Sources/App/FlowHubHome.swift@@ -86,11 +86,8 @@ struct HubHomePage: View {}if store.history.isEmpty {HubCard {- Text(store.keepDays == 0 ? String(localized: "hub.history-off")- : String(format: String(localized: "hub.history-empty %@"), flow.key.label))- .font(.system(size: 14))- .foregroundColor(HubTheme.secondary)- .fixedSize(horizontal: false, vertical: true)+ HubEmptyState(text: store.keepDays == 0 ? String(localized: "hub.history-off")+ : String(format: String(localized: "hub.history-empty %@"), flow.key.label))}} else if groups.isEmpty {Text("hub.search-empty")diff --git a/NotchBuddy/Sources/App/FlowHubMochis.swift b/NotchBuddy/Sources/App/FlowHubMochis.swiftnew file mode 100644index 00000000..dda733c6--- /dev/null+++ b/NotchBuddy/Sources/App/FlowHubMochis.swift@@ -0,0 +1,382 @@+#if !APPSTORE+import AppKit+import SwiftUI++// MARK: - Visible or not++private struct HubVisibleKey: EnvironmentKey {+ static let defaultValue = true+}++extension EnvironmentValues {+ /// Whether the Coucou window is on screen: the Mochis rest (no frame drawn) while it is hidden,+ /// minimized or covered.+ var hubVisible: Bool {+ get { self[HubVisibleKey.self] }+ set { self[HubVisibleKey.self] = newValue }+ }+}++/// Follows the Coucou window's occlusion, for `hubVisible`.+@MainActor+final class HubWindowState: ObservableObject {+ @Published private(set) var visible = true+ private var observers: [NSObjectProtocol] = []++ func watch(_ window: NSWindow) {+ observers.forEach { NotificationCenter.default.removeObserver($0) }+ let names: [Notification.Name] = [NSWindow.didChangeOcclusionStateNotification,+ NSWindow.didMiniaturizeNotification,+ NSWindow.didDeminiaturizeNotification,+ NSWindow.willCloseNotification]+ observers = names.map { name in+ NotificationCenter.default.addObserver(forName: name, object: window, queue: .main) { [weak self] note in+ let closing = note.name == NSWindow.willCloseNotification+ MainActor.assumeIsolated {+ guard let self else { return }+ let on = !closing && window.occlusionState.contains(.visible) && !window.isMiniaturized+ if on != self.visible { self.visible = on }+ }+ }+ }+ }+}++// MARK: - A troupe of mini Mochis++/// One Mochi of a scene: its look, and whether it walks around.+struct HubMochiSpec: Hashable {+ var color: String+ /// The drawing's width in points (the body is about two thirds of it).+ var size: CGFloat+ var outfit: Outfit = .none+ var state: BotState = .idle+ /// Walks left and right, stops, looks around. Otherwise stays where it is.+ var roams = true+ /// Where it starts, from 0 (left of its area) to 1 (right).+ var start: CGFloat = 0.5+}++/// The Mochis of a scene, moved frame by frame.+@MainActor+final class HubMochiTroupe: ObservableObject {+ @MainActor final class Walker {+ let spec: HubMochiSpec+ let engine: BotEngine+ var x: CGFloat+ var target: CGFloat+ var speed: CGFloat = 0.06+ var restUntil: Double+ var hop: CGFloat = 0+ var lastHello: Double = 0++ init(spec: HubMochiSpec) {+ self.spec = spec+ let e = BotEngine()+ e.isMini = true+ e.bodyColor = cgColorFromHex(spec.color)+ if spec.outfit != .none { e.setOutfit(spec.outfit, animated: false) }+ if spec.state != .idle { e.setState(spec.state, force: true) }+ engine = e+ x = spec.start+ target = spec.start+ restUntil = CACurrentMediaTime() + Double.random(in: 0.5...3)+ }+ }++ private(set) var walkers: [Walker] = []+ private var last = CACurrentMediaTime()+ /// The part of the scene where they walk, from 0 to 1.+ var range: ClosedRange<CGFloat> = 0.05...0.95++ init(cast: [HubMochiSpec]) {+ walkers = cast.map { Walker(spec: $0) }+ }++ /// One frame: the walkers move, and stop now and then to do a little something.+ func step() {+ let now = CACurrentMediaTime()+ let dt = CGFloat(min(0.05, max(0, now - last)))+ last = now+ for actor in walkers {+ MochiFrameClock.advance(actor.engine)+ guard actor.spec.roams else { continue }+ if now < actor.restUntil {+ actor.hop = max(0, actor.hop - dt * 4)+ continue+ }+ let distance = actor.target - actor.x+ if abs(distance) < 0.004 {+ arrive(actor, now: now)+ continue+ }+ let move = min(abs(distance), actor.speed * dt)+ actor.x += distance > 0 ? move : -move+ actor.hop += dt * 9+ }+ }++ private func arrive(_ actor: Walker, now: Double) {+ actor.hop = 0+ actor.restUntil = now + Double.random(in: 1.2...5)+ actor.target = CGFloat.random(in: range)+ actor.speed = CGFloat.random(in: 0.035...0.08)+ // A little something once there.+ switch Int.random(in: 0..<10) {+ case 0, 1: actor.engine.triggerEmote(.happy, silent: true)+ case 2: actor.engine.triggerEmote(.wink, silent: true)+ case 3: actor.engine.doRoll(duration: 900, turns: 1)+ default: break+ }+ // Two Mochis meeting say hello.+ for other in walkers where other !== actor && abs(other.x - actor.x) < 0.09 && now - actor.lastHello > 12 {+ actor.lastHello = now+ other.lastHello = now+ actor.engine.triggerEmote(.love, silent: true)+ other.engine.triggerEmote(.happy, silent: true)+ break+ }+ }++ /// A click on a Mochi: it blushes and jumps.+ func poke(at point: CGPoint, in size: CGSize) {+ let hit = walkers.min { distance(point, $0, size) < distance(point, $1, size) }+ guard let hit, distance(point, hit, size) < hit.spec.size * 0.6 else { return }+ hit.engine.triggerEmote(.love, silent: true)+ hit.engine.squash()+ hit.restUntil = CACurrentMediaTime() + 2+ }++ private func distance(_ p: CGPoint, _ actor: Walker, _ size: CGSize) -> CGFloat {+ let center = CGPoint(x: xPosition(actor, width: size.width), y: size.height - actor.spec.size * 0.45)+ return hypot(p.x - center.x, p.y - center.y)+ }++ func xPosition(_ actor: Walker, width: CGFloat) -> CGFloat {+ let half = actor.spec.size / 2+ return half + actor.x * max(0, width - actor.spec.size)+ }++ func draw(_ context: inout GraphicsContext, size: CGSize) {+ // Back to front: the small ones behind.+ for actor in walkers.sorted(by: { $0.spec.size < $1.spec.size }) {+ let w = actor.spec.size+ let cx = xPosition(actor, width: size.width)+ let lift = actor.spec.roams ? abs(sin(actor.hop)) * w * 0.07 : 0+ // Its shadow on the floor (a scene, not a lone Mochi).+ if size.height > w * 1.05 || walkers.count > 1 {+ let shadow = CGRect(x: cx - w * 0.26, y: size.height - w * 0.12, width: w * 0.52, height: w * 0.09)+ context.fill(Path(ellipseIn: shadow), with: .color(.black.opacity(0.28 - Double(lift / w))))+ }+ var c = context+ c.translateBy(x: cx - w / 2, y: size.height - w * 0.92 - lift)+ actor.engine.draw(context: c, size: CGSize(width: w, height: w))+ }+ }+}++/// A strip where a few mini Mochis live: drawn in one canvas, at the display's rate while the+/// window shows, still otherwise. Click one to say hello.+struct HubMochiScene: View {+ @StateObject private var troupe: HubMochiTroupe+ @Environment(\.hubVisible) private var visible++ init(cast: [HubMochiSpec], range: ClosedRange<CGFloat> = 0.05...0.95) {+ _troupe = StateObject(wrappedValue: {+ let t = HubMochiTroupe(cast: cast)+ t.range = range+ return t+ }())+ }++ var body: some View {+ GeometryReader { geo in+ TimelineView(.animation(paused: !visible)) { timeline in+ let frame = timeline.date+ Canvas { context, size in+ _ = frame+ troupe.step()+ troupe.draw(&context, size: size)+ }+ }+ .contentShape(Rectangle())+ .onTapGesture { location in troupe.poke(at: location, in: geo.size) }+ }+ }+}++/// One Mochi that stays where it is (the logo, the empty pages).+struct HubLiveMochi: View {+ var color = "#F5F6F8"+ /// Width of the body; the drawing around it is larger.+ var size: CGFloat = 28+ var state: BotState = .idle+ var outfit: Outfit = .none++ var body: some View {+ HubMochiScene(cast: [HubMochiSpec(color: color, size: size / 0.68, outfit: outfit, state: state, roams: false)])+ .frame(width: size / 0.68, height: size / 0.68)+ .frame(width: size, height: size * 0.75)+ }+}++// MARK: - The top of each page++/// A page's colour and its Mochis.+struct HubHeroTheme {+ var color: Color+ var cast: [HubMochiSpec]++ static func of(_ page: HubPage) -> HubHeroTheme {+ func m(_ color: String, _ size: CGFloat, _ start: CGFloat, outfit: Outfit = .none,+ state: BotState = .idle, roams: Bool = true) -> HubMochiSpec {+ HubMochiSpec(color: color, size: size, outfit: outfit, state: state, roams: roams, start: start)+ }+ switch page {+ case .dictation:+ return .init(color: Color(hex: "#FB923C"), cast: [m("#F5F6F8", 66, 0.2), m("#FB923C", 52, 0.65), m("#F472B6", 44, 0.95, outfit: .bow)])+ case .notes:+ return .init(color: Color(hex: "#3B9EFF"), cast: [m("#3B9EFF", 58, 0.1, outfit: .roundGlasses), m("#34D399", 50, 0.5), m("#A78BFA", 46, 0.9)])+ case .insights:+ return .init(color: Color(hex: "#34D399"), cast: [m("#F7B32B", 62, 0.3, outfit: .crown), m("#34D399", 48, 0.75), m("#F5F6F8", 40, 1)])+ case .dictionary:+ return .init(color: Color(hex: "#A78BFA"), cast: [m("#A78BFA", 60, 0.2, outfit: .roundGlasses), m("#F5F6F8", 48, 0.8, outfit: .beanie)])+ case .snippets:+ return .init(color: Color(hex: "#F7B32B"), cast: [m("#F7B32B", 56, 0.15, state: .working), m("#FB923C", 46, 0.6), m("#F5F6F8", 40, 0.95)])+ case .styles:+ return .init(color: Color(hex: "#F472B6"), cast: [m("#F472B6", 60, 0.25, outfit: .sunglasses), m("#F5F6F8", 48, 0.7, outfit: .bow), m("#22D3EE", 42, 1, outfit: .partyHat)])+ case .settings:+ return .init(color: Color(hex: "#8E939C"), cast: [m("#F5F6F8", 56, 0.3), m("#8E939C", 46, 0.95, state: .sleeping, roams: false)])+ case .general:+ return .init(color: Color(hex: "#8E939C"), cast: [m("#F5F6F8", 60, 0.4, outfit: .scarf), m("#FB923C", 46, 0.85)])+ case .pills:+ return .init(color: Color(hex: "#F5A524"), cast: [m("#F5A524", 44, 0.05), m("#3B9EFF", 44, 0.3), m("#34D399", 44, 0.55),+ m("#E07950", 44, 0.8), m("#A78BFA", 44, 1)])+ case .agents:+ return .init(color: Color(hex: "#3B9EFF"), cast: [m("#3B9EFF", 56, 0.1, state: .working, roams: false),+ m("#E07950", 50, 0.5, state: .thinking, roams: false),+ m("#34D399", 50, 0.9)])+ case .chat:+ return .init(color: Color(hex: "#E07950"), cast: [m("#E07950", 58, 0.3, state: .thinking, roams: false), m("#F5F6F8", 48, 0.85)])+ case .integrations:+ return .init(color: Color(hex: "#7C5CFF"), cast: [m("#7C5CFF", 54, 0.15), m("#22D3EE", 46, 0.55), m("#F7B32B", 42, 0.95)])+ case .voice:+ return .init(color: Color(hex: "#F97316"), cast: [m("#F97316", 60, 0.3), m("#F5F6F8", 48, 0.85, outfit: .roundGlasses)])+ case .shortcuts:+ return .init(color: Color(hex: "#6366F1"), cast: [m("#6366F1", 56, 0.2, outfit: .sunglasses), m("#F5F6F8", 46, 0.8)])+ }+ }+}++/// The top of a page: a coloured band with the title, a line, an action, and the page's Mochis+/// walking on its floor.+struct HubHero<Trailing: View>: View {+ let page: HubPage+ let title: String+ var subtitle: String?+ var compact = false+ @ViewBuilder var trailing: () -> Trailing++ var body: some View {+ let theme = HubHeroTheme.of(page)+ ZStack(alignment: .bottomTrailing) {+ RoundedRectangle(cornerRadius: 18, style: .continuous)+ .fill(LinearGradient(colors: [theme.color.opacity(0.20), theme.color.opacity(0.05), Color.white.opacity(0.015)],+ startPoint: .topTrailing, endPoint: .bottomLeading))+ RoundedRectangle(cornerRadius: 18, style: .continuous)+ .fill(RadialGradient(colors: [theme.color.opacity(0.28), .clear], center: .topTrailing,+ startRadius: 0, endRadius: 320))+ HubSparkles(color: theme.color)+ .allowsHitTesting(false)+ HubMochiScene(cast: theme.cast, range: 0...1)+ .id(page)+ .frame(width: compact ? 280 : 340, height: compact ? 92 : 128)+ .padding(.trailing, 18)+ .padding(.bottom, 6)+ HStack(alignment: .top) {+ VStack(alignment: .leading, spacing: 8) {+ Text(title)+ .font(.system(size: compact ? 24 : 30, weight: .bold))+ .tracking(-0.6)+ if let subtitle {+ Text(subtitle)+ .font(.system(size: 14))+ .foregroundColor(Color(hex: "#B7BBC2"))+ .fixedSize(horizontal: false, vertical: true)+ .frame(maxWidth: 420, alignment: .leading)+ }+ Spacer(minLength: 0)+ trailing()+ }+ .padding(compact ? 20 : 26)+ Spacer(minLength: compact ? 290 : 350)+ }+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)+ }+ .frame(height: compact ? 116 : 170)+ .clipShape(RoundedRectangle(cornerRadius: 18, style: .continuous))+ .overlay(RoundedRectangle(cornerRadius: 18, style: .continuous).strokeBorder(theme.color.opacity(0.22)))+ }+}++extension HubHero where Trailing == EmptyView {+ init(page: HubPage, title: String, subtitle: String? = nil, compact: Bool = false) {+ self.page = page+ self.title = title+ self.subtitle = subtitle+ self.compact = compact+ self.trailing = { EmptyView() }+ }+}++/// A few still sparkles in the band's colour.+private struct HubSparkles: View {+ let color: Color++ var body: some View {+ Canvas { context, size in+ var rng = SeededRandom(seed: 7)+ for _ in 0..<26 {+ let x = rng.next() * size.width+ let y = rng.next() * size.height+ let r = 0.6 + rng.next() * 1.6+ let alpha = 0.10 + rng.next() * 0.35+ context.fill(Path(ellipseIn: CGRect(x: x, y: y, width: r * 2, height: r * 2)),+ with: .color(color.opacity(alpha)))+ }+ }+ }+}++/// Always the same sparkles, so they do not move when the page redraws.+private struct SeededRandom {+ var state: UInt64+ init(seed: UInt64) { state = seed }+ mutating func next() -> CGFloat {+ state = state &* 6364136223846793005 &+ 1442695040888963407+ return CGFloat((state >> 33) % 10_000) / 10_000+ }+}++/// An empty page: a Mochi asleep, and a line.+struct HubEmptyState: View {+ let text: String+ var state: BotState = .sleeping+ var color = "#F5F6F8"++ var body: some View {+ VStack(spacing: 10) {+ HubLiveMochi(color: color, size: 54, state: state)+ .frame(height: 54)+ Text(text)+ .font(.system(size: 13.5))+ .foregroundColor(HubTheme.secondary)+ .multilineTextAlignment(.center)+ .fixedSize(horizontal: false, vertical: true)+ .frame(maxWidth: 380)+ }+ .frame(maxWidth: .infinity)+ .padding(.vertical, 22)+ }+}+#endifdiff --git a/NotchBuddy/Sources/App/FlowHubNotes.swift b/NotchBuddy/Sources/App/FlowHubNotes.swiftindex eca95dd4..7e235c5f 100644--- a/NotchBuddy/Sources/App/FlowHubNotes.swift+++ b/NotchBuddy/Sources/App/FlowHubNotes.swift@@ -15,6 +15,11 @@ struct HubNotesPage: View {}var body: some View {+ VStack(spacing: 0) {+ HubHero(page: .notes, title: String(localized: "hub.page.notes"),+ subtitle: String(localized: "hub.notes-promo"), compact: true)+ .padding(.horizontal, 20)+ .padding(.top, 20)HStack(spacing: 0) {HubNotesList(selected: $selected).frame(width: 280)@@ -34,6 +39,7 @@ struct HubNotesPage: View {}.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)}+ }}}@@ -49,7 +55,7 @@ private struct HubNotesList: View {HubRecordButton {selected = nil}- .padding(.top, 34)+ .padding(.top, 16)if let error = taker.startError {Text(error).font(.system(size: 12))@@ -198,12 +204,8 @@ private struct HubNotesSetup: View {var body: some View {VStack(alignment: .leading, spacing: 16) {- Text("hub.page.notes")- .font(.system(size: 28, weight: .bold))- Text("hub.notes-promo")- .font(.system(size: 14))- .foregroundColor(HubTheme.secondary)- .fixedSize(horizontal: false, vertical: true)+ HubLiveMochi(color: "#3B9EFF", size: 54, outfit: .roundGlasses)+ .frame(height: 50)HubCard(padding: 20) {Text("notes.setup-title").font(.system(size: 15, weight: .bold))@@ -227,24 +229,15 @@ private struct HubNotesSetup: View {}.frame(maxWidth: 560)}- .padding(.horizontal, 40)- .padding(.top, 38)+ .padding(.horizontal, 32)+ .padding(.top, 20)}}private struct HubNotesEmpty: View {var body: some View {- VStack(spacing: 12) {- Image(systemName: "waveform")- .font(.system(size: 30))- .foregroundColor(HubTheme.muted)- Text("notes.empty")- .font(.system(size: 14))- .foregroundColor(HubTheme.secondary)- .multilineTextAlignment(.center)- .frame(maxWidth: 360)- }- .frame(maxWidth: .infinity, maxHeight: .infinity)+ HubEmptyState(text: String(localized: "notes.empty"), state: .idle, color: "#3B9EFF")+ .frame(maxWidth: .infinity, maxHeight: .infinity)}}@@ -292,8 +285,8 @@ private struct HubLiveNote: View {}}}- .padding(.horizontal, 36)- .padding(.top, 38)+ .padding(.horizontal, 32)+ .padding(.top, 20)}}@@ -390,8 +383,8 @@ private struct HubNoteDetail: View {if tab == 0 { summary } else { transcript }}}- .padding(.horizontal, 36)- .padding(.top, 38)+ .padding(.horizontal, 32)+ .padding(.top, 20).padding(.bottom, 30).frame(maxWidth: 980, alignment: .leading)}diff --git a/NotchBuddy/Sources/App/FlowHubWords.swift b/NotchBuddy/Sources/App/FlowHubWords.swiftindex 7838179d..7626673e 100644--- a/NotchBuddy/Sources/App/FlowHubWords.swift+++ b/NotchBuddy/Sources/App/FlowHubWords.swift@@ -20,9 +20,7 @@ struct HubDictionaryPage: View {.disabled(newWord.trimmingCharacters(in: .whitespaces).isEmpty)}if store.words.isEmpty {- Text("hub.words-empty")- .font(.system(size: 13))- .foregroundColor(HubTheme.secondary)+ HubEmptyState(text: String(localized: "hub.words-empty"), state: .idle, color: "#A78BFA")} else {HubWrap(spacing: 8) {ForEach(store.words, id: \.self) { word in@@ -151,9 +149,7 @@ struct HubSnippetsPage: View {}}if store.snippets.isEmpty {- Text("hub.snippets-empty")- .font(.system(size: 13))- .foregroundColor(HubTheme.secondary)+ HubEmptyState(text: String(localized: "hub.snippets-empty"), color: "#F7B32B")}ForEach(store.snippets) { snippet inHubCard {diff --git a/NotchBuddy/Sources/App/SettingsView.swift b/NotchBuddy/Sources/App/SettingsView.swiftindex 70f59e04..6dad9804 100644--- a/NotchBuddy/Sources/App/SettingsView.swift+++ b/NotchBuddy/Sources/App/SettingsView.swift@@ -213,18 +213,13 @@ struct SettingsView: View {.padding(.horizontal, 20).padding(.top, 20).padding(.bottom, 12)- } else {- Text(sectionTitle)- .font(.system(size: 28, weight: .bold))- .padding(.horizontal, 40)- .padding(.top, 38)- .padding(.bottom, 18)}ScrollView {VStack(alignment: .leading, spacing: 18) {sectionContent}- .padding(.horizontal, embeddedSection == nil ? 20 : 40)+ .padding(.horizontal, embeddedSection == nil ? 20 : 28)+ .padding(.top, embeddedSection == nil ? 0 : 20).padding(.bottom, 16).frame(maxWidth: embeddedSection == nil ? .infinity : 760, alignment: .leading)}