feat:mac os
This commit is contained in:
1 parent
136bf7cfa3
commit
3400e2b465
18 files changed
+1129
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import AppKit
|
||||
import SwiftUI
|
||||
|
||||
final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
func applicationDidFinishLaunching(_ notification: Notification) {
|
||||
NSApp.setActivationPolicy(.accessory)
|
||||
}
|
||||
}
|
||||
|
||||
@main
|
||||
struct TransuiApp: App {
|
||||
@NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
|
||||
@StateObject private var model = AppModel()
|
||||
|
||||
var body: some Scene {
|
||||
MenuBarExtra {
|
||||
Button(model.isRecording ? "Stop and transcribe" : "Start recording") {
|
||||
model.toggleRecording()
|
||||
}
|
||||
.keyboardShortcut("r")
|
||||
.disabled(model.state == .transcribing)
|
||||
|
||||
if model.isRecording {
|
||||
Button("Cancel recording", role: .destructive) {
|
||||
model.cancelRecording()
|
||||
}
|
||||
}
|
||||
|
||||
Divider()
|
||||
SettingsLink { Text("Settings…") }
|
||||
Divider()
|
||||
Button("Quit Transui") { NSApp.terminate(nil) }
|
||||
.keyboardShortcut("q")
|
||||
} label: {
|
||||
Image(systemName: model.isRecording ? "waveform.circle.fill" : "waveform")
|
||||
.accessibilityLabel(model.isRecording ? "Transui recording" : "Transui")
|
||||
}
|
||||
|
||||
Settings {
|
||||
SettingsView(model: model)
|
||||
}
|
||||
.windowResizability(.contentSize)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user