// // ZyquoMLXApp.swift // Zyquo MLX // // Author: Simon-Pierre Boucher // Mail: contact@spboucher.ai // import SwiftUI /// Zyquo MLX — the local MLX foundry for the Mac. /// /// The SwiftUI application (invoked from `Main` unless CLI mode runs). Gates /// on Apple Silicon (MLX requires it), activates properly when launched from /// a terminal, and hosts the main workbench window. struct ZyquoMLXApp: App { init() { // Launching a bare executable from the terminal does not activate it; // make sure the window comes to the front like a real Mac app. DispatchQueue.main.async { NSApplication.shared.setActivationPolicy(.regular) NSApplication.shared.activate(ignoringOtherApps: true) } } @AppStorage("appearance") private var appearance = "system" var body: some Scene { WindowGroup { Group { if HardwareGate.isAppleSilicon { WorkbenchView() } else { UnsupportedHardwareView() } } .preferredColorScheme(colorScheme) } .defaultSize( width: ZyquoTheme.defaultWindowSize.width, height: ZyquoTheme.defaultWindowSize.height) .commands { CommandMenu("Foundry") { ForEach(WorkbenchSection.allCases) { section in Button(section.title) { NotificationCenter.default.post( name: .zyquoNavigate, object: section) } .keyboardShortcut(section.shortcut, modifiers: .command) } } } Settings { SettingsView() .preferredColorScheme(colorScheme) } } private var colorScheme: ColorScheme? { switch appearance { case "light": .light case "dark": .dark default: nil } } }