Fix Preferences missing from the standard app menu: 1.8.1's workaround for
LSUIElement (plain Window + openWindow) was never swapped back for a real
Settings{} scene after 1.8.2 removed LSUIElement, so there was still no
Preferences item in the app's own menu or Cmd+, binding, only a button in
the main window and a menu-bar-dropdown item. Restored Settings{} now that
the app menu exists to host it; menu bar dropdown and main window button
both use the standard openSettings()/SettingsLink instead of a custom
openWindow(id:). Net simplification -- removes the now-redundant window ID
and controller method.
All unit tests pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
37 lines
1.2 KiB
Swift
37 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
@main
|
|
struct BusyMirrorApp: App {
|
|
@StateObject private var appController = BusyMirrorAppController()
|
|
|
|
private var menuBarIcon: String {
|
|
if appController.isSyncing { return "arrow.triangle.2.circlepath.circle.fill" }
|
|
if appController.lastRunFailed { return "exclamationmark.triangle.fill" }
|
|
return "calendar.badge.clock"
|
|
}
|
|
|
|
var body: some Scene {
|
|
Window("BusyMirror", id: BusyMirrorSceneID.mainWindow) {
|
|
ContentView()
|
|
.environmentObject(appController)
|
|
.frame(minWidth: 720, minHeight: 520)
|
|
}
|
|
.defaultSize(width: 1120, height: 760)
|
|
|
|
MenuBarExtra("BusyMirror", systemImage: menuBarIcon) {
|
|
BusyMirrorMenuBarView()
|
|
.environmentObject(appController)
|
|
}
|
|
|
|
// A real Settings scene: now that the app is standard (not
|
|
// LSUIElement), this gets the conventional Cmd+, and a "Preferences…"
|
|
// item in the app's own menu for free — the location people actually
|
|
// look, unlike a plain Window which only opens from wherever we
|
|
// explicitly put a button for it.
|
|
Settings {
|
|
PreferencesView()
|
|
.environmentObject(appController)
|
|
}
|
|
}
|
|
}
|