Release 1.8.3
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>
This commit is contained in:
@@ -23,17 +23,14 @@ struct BusyMirrorApp: App {
|
||||
.environmentObject(appController)
|
||||
}
|
||||
|
||||
// A plain Window rather than a Settings scene: this was originally
|
||||
// required because the app was LSUIElement (accessory) and got no
|
||||
// standard app menu for Cmd+,/SettingsLink to hook into. Now that
|
||||
// it's a standard app that menu exists, but openWindow(id:) already
|
||||
// works reliably (same mechanism as the main window) so there's no
|
||||
// reason to switch back.
|
||||
Window("Preferences", id: BusyMirrorSceneID.preferencesWindow) {
|
||||
// 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)
|
||||
}
|
||||
.defaultSize(width: 480, height: 560)
|
||||
.windowResizability(.contentSize)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ struct Route: Identifiable, Hashable, Codable {
|
||||
|
||||
struct ContentView: View {
|
||||
@EnvironmentObject private var appController: BusyMirrorAppController
|
||||
@Environment(\.openWindow) private var openWindow
|
||||
@State private var store = EKEventStore()
|
||||
@State private var hasAccess = false
|
||||
@State private var calendars: [EKCalendar] = []
|
||||
@@ -616,8 +615,8 @@ struct ContentView: View {
|
||||
Text("Mirroring defaults, filters, and work hours moved to Preferences.")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
Button("Open Preferences…") {
|
||||
appController.openPreferencesWindow(using: openWindow)
|
||||
SettingsLink {
|
||||
Text("Open Preferences…")
|
||||
}
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import ServiceManagement
|
||||
|
||||
enum BusyMirrorSceneID {
|
||||
static let mainWindow = "main-window"
|
||||
static let preferencesWindow = "preferences-window"
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@@ -67,11 +66,6 @@ final class BusyMirrorAppController: ObservableObject {
|
||||
openWindow(id: BusyMirrorSceneID.mainWindow)
|
||||
}
|
||||
|
||||
func openPreferencesWindow(using openWindow: OpenWindowAction) {
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
openWindow(id: BusyMirrorSceneID.preferencesWindow)
|
||||
}
|
||||
|
||||
// MARK: - Event-driven background sync
|
||||
//
|
||||
// Owned here (not by ContentView) because this controller lives for the
|
||||
@@ -256,6 +250,7 @@ final class BusyMirrorAppController: ObservableObject {
|
||||
|
||||
struct BusyMirrorMenuBarView: View {
|
||||
@Environment(\.openWindow) private var openWindow
|
||||
@Environment(\.openSettings) private var openSettings
|
||||
@EnvironmentObject private var appController: BusyMirrorAppController
|
||||
|
||||
var body: some View {
|
||||
@@ -287,7 +282,8 @@ struct BusyMirrorMenuBarView: View {
|
||||
}
|
||||
|
||||
Button("Preferences…") {
|
||||
appController.openPreferencesWindow(using: openWindow)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
openSettings()
|
||||
}
|
||||
|
||||
Divider()
|
||||
|
||||
Reference in New Issue
Block a user