Open Settings in a dedicated resizable macOS window

This commit is contained in:
Arkadiusz Fal
2026-04-22 21:59:34 +02:00
parent 4d45f6870e
commit 397fc46629
2 changed files with 35 additions and 9 deletions

View File

@@ -17,14 +17,20 @@ struct FileCommands: Commands {
}
.keyboardShortcut("o", modifiers: [.command])
}
#if os(macOS)
CommandGroup(replacing: .appSettings) {
Button(String(localized: "menu.app.settings")) {
NotificationCenter.default.post(name: .showSettings, object: nil)
}
.keyboardShortcut(",", modifiers: [.command])
}
#endif
}
}
#endif
#if os(macOS)
/// App menu Settings item that opens the dedicated Settings window.
struct SettingsWindowMenuItem: View {
@Environment(\.openWindow) private var openWindow
var body: some View {
Button(String(localized: "menu.app.settings")) {
openWindow(id: "settings")
}
.keyboardShortcut(",", modifiers: [.command])
}
}
#endif