mirror of
https://github.com/BigMarc/grammargem.git
synced 2026-10-13 17:01:55 +02:00
Native SwiftUI menu-bar app: global hotkey → capture selected text (AX API / clipboard fallback) → grammar (Harper) / local AI (MLX) → replace in place. Free/paid entitlement gate + Lemon Squeezy device-cap licensing, $0 marginal cost per user. Heavyweight engines behind protocol stubs so it builds out of the box. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
33 lines
1.0 KiB
Swift
33 lines
1.0 KiB
Swift
import SwiftUI
|
|
import AppKit
|
|
|
|
/// App entry point. A menu-bar (`LSUIElement`) SwiftUI app: the only persistent
|
|
/// scene is the `MenuBarExtra`; Settings uses the standard scene; Onboarding and
|
|
/// Ask are AppKit-hosted windows opened on demand (see `AppState`).
|
|
@main
|
|
struct GrammaGemApp: App {
|
|
@NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
|
|
@StateObject private var app = AppState.shared
|
|
|
|
var body: some Scene {
|
|
MenuBarExtra("GrammaGem", systemImage: "pencil.and.scribble") {
|
|
MenuBarContent()
|
|
.environmentObject(app)
|
|
}
|
|
.menuBarExtraStyle(.window)
|
|
|
|
Settings {
|
|
SettingsView()
|
|
.environmentObject(app)
|
|
.frame(width: 560, height: 520)
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Runs launch-time wiring (hotkeys, permissions, license validation).
|
|
final class AppDelegate: NSObject, NSApplicationDelegate {
|
|
func applicationDidFinishLaunching(_ notification: Notification) {
|
|
AppState.shared.start()
|
|
}
|
|
}
|