38 lines
1.4 KiB
Swift
38 lines
1.4 KiB
Swift
import SwiftUI
|
|
import Combine
|
|
|
|
@main
|
|
struct CxWebAppMacApp: App {
|
|
@StateObject private var settings = AppSettings()
|
|
private let webAction = PassthroughSubject<WebView.WebAction, Never>()
|
|
|
|
var body: some Scene {
|
|
WindowGroup("CxWebApp") {
|
|
ContentView(webAction: webAction)
|
|
.environmentObject(settings)
|
|
}
|
|
.windowToolbarStyle(.unified)
|
|
.commands {
|
|
CommandGroup(after: .toolbar) {
|
|
Button("Reload") { webAction.send(.reload) }
|
|
.keyboardShortcut("r", modifiers: [.command])
|
|
Button("Back") { webAction.send(.back) }
|
|
.keyboardShortcut("[", modifiers: [.command])
|
|
Button("Forward") { webAction.send(.forward) }
|
|
.keyboardShortcut("]", modifiers: [.command])
|
|
Divider()
|
|
Button("Home") { webAction.send(.home) }
|
|
.keyboardShortcut("h", modifiers: [.command, .shift])
|
|
Button("Copy URL") { webAction.send(.copyURL) }
|
|
.keyboardShortcut("c", modifiers: [.command, .shift])
|
|
Button("Open in Browser") { webAction.send(.openInBrowser) }
|
|
.keyboardShortcut("o", modifiers: [.command, .shift])
|
|
}
|
|
}
|
|
|
|
Settings {
|
|
SettingsView().environmentObject(settings)
|
|
}
|
|
}
|
|
}
|