Release 1.8.1
Fix Preferences window being unreachable in 1.8.0: BusyMirror is LSUIElement
(accessory), so it never gets the standard app menu that the automatic
Settings scene's Cmd+, / SettingsLink depend on. Replaced Settings{} with a
plain Window opened via openWindow(id:) -- the same mechanism already used
for the main window -- and added a "Preferences..." item to the menu bar
dropdown as a second, more discoverable entry point.
All unit tests pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,9 +23,17 @@ struct BusyMirrorApp: App {
|
||||
.environmentObject(appController)
|
||||
}
|
||||
|
||||
Settings {
|
||||
// A plain Window (not a Settings scene) — LSUIElement (accessory)
|
||||
// apps don't get the standard app menu, so Cmd+, / the automatic
|
||||
// "Settings…" command has no menu to live in and SettingsLink has
|
||||
// nothing reliable to trigger. openWindow(id:) is the same mechanism
|
||||
// that already reliably opens the main window from the menu bar, so
|
||||
// reuse it here instead.
|
||||
Window("Preferences", id: BusyMirrorSceneID.preferencesWindow) {
|
||||
PreferencesView()
|
||||
.environmentObject(appController)
|
||||
}
|
||||
.defaultSize(width: 480, height: 560)
|
||||
.windowResizability(.contentSize)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ 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] = []
|
||||
@@ -615,8 +616,8 @@ struct ContentView: View {
|
||||
Text("Mirroring defaults, filters, and work hours moved to Preferences.")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
SettingsLink {
|
||||
Text("Open Preferences…")
|
||||
Button("Open Preferences…") {
|
||||
appController.openPreferencesWindow(using: openWindow)
|
||||
}
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import ServiceManagement
|
||||
|
||||
enum BusyMirrorSceneID {
|
||||
static let mainWindow = "main-window"
|
||||
static let preferencesWindow = "preferences-window"
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@@ -66,6 +67,11 @@ 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
|
||||
@@ -280,6 +286,10 @@ struct BusyMirrorMenuBarView: View {
|
||||
appController.openMainWindow(using: openWindow)
|
||||
}
|
||||
|
||||
Button("Preferences…") {
|
||||
appController.openPreferencesWindow(using: openWindow)
|
||||
}
|
||||
|
||||
Divider()
|
||||
|
||||
Button("Quit BusyMirror") {
|
||||
|
||||
Reference in New Issue
Block a user