learning_ai_clock/ios/ChronoMindMac/ChronoMindMacApp.swift

40 lines
1.2 KiB
Swift

// ChronoMind macOS Menu Bar App
// Native macOS menu bar app sharing 90%+ code with iOS via Shared/
import SwiftUI
@main
struct ChronoMindMacApp: App {
@StateObject private var menuBarState = MenuBarState.shared
@StateObject private var timerStore = MacTimerStore.shared
var body: some Scene {
// Menu bar extra always visible
MenuBarExtra {
MenuBarPopover()
.environmentObject(timerStore)
.environmentObject(menuBarState)
} label: {
menuBarLabel
}
.menuBarExtraStyle(.window)
// Settings window
Settings {
MacSettingsView()
.environmentObject(timerStore)
}
}
private var menuBarLabel: some View {
HStack(spacing: 4) {
Image(systemName: "clock.fill")
if let next = timerStore.nextFiringTimer {
let remaining = getRemainingSeconds(next, now: timerStore.now)
Text(formatDurationCompact(remaining))
.monospacedDigit()
}
}
}
}