38 lines
1.2 KiB
Swift
38 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
struct AppCommands: Commands {
|
|
@ObservedObject var model: AppModel
|
|
@Environment(\.openWindow) private var openWindow
|
|
|
|
var body: some Commands {
|
|
CommandGroup(after: .pasteboard) {
|
|
Divider()
|
|
Button(Strings.clearHistory) {
|
|
openWindow(id: "main")
|
|
model.confirmingClearHistory = true
|
|
}
|
|
}
|
|
CommandMenu(Strings.recordingMenu) {
|
|
Button(model.isRecording ? Strings.stopRecording : Strings.startRecording) {
|
|
model.toggleWindowRecording()
|
|
}
|
|
.keyboardShortcut("r", modifiers: [.command, .option])
|
|
Divider()
|
|
Button(Strings.transcripts) { show(.transcripts) }
|
|
.keyboardShortcut("1", modifiers: .command)
|
|
Button(Strings.dictionary) { show(.dictionary) }
|
|
.keyboardShortcut("2", modifiers: .command)
|
|
Button(Strings.search) {
|
|
show(model.section)
|
|
model.focusSearch()
|
|
}
|
|
.keyboardShortcut("f", modifiers: .command)
|
|
}
|
|
}
|
|
|
|
private func show(_ section: AppModel.Section) {
|
|
openWindow(id: "main")
|
|
model.show(section)
|
|
}
|
|
}
|