35 lines
1.2 KiB
Swift
35 lines
1.2 KiB
Swift
import AppKit
|
|
import SwiftUI
|
|
|
|
struct MenuContent: View {
|
|
@ObservedObject var model: AppModel
|
|
|
|
var body: some View {
|
|
Text(model.statusLine)
|
|
if let error = model.lastError {
|
|
Text("Fout: \(error)")
|
|
}
|
|
Divider()
|
|
permissionRow("Microfoon", granted: model.micGranted, pane: "Privacy_Microphone")
|
|
permissionRow("Accessibility", granted: model.accessibilityGranted, pane: "Privacy_Accessibility")
|
|
permissionRow("Input Monitoring", granted: model.inputMonitoringGranted, pane: "Privacy_ListenEvent")
|
|
Button("Rechten opnieuw controleren") { model.retryHotkey() }
|
|
Divider()
|
|
Button("Stop") { NSApplication.shared.terminate(nil) }
|
|
.keyboardShortcut("q")
|
|
}
|
|
|
|
@ViewBuilder
|
|
private func permissionRow(_ title: String, granted: Bool, pane: String) -> some View {
|
|
if granted {
|
|
Text("✓ \(title)")
|
|
} else {
|
|
Button("⚠︎ \(title) — open Instellingen") {
|
|
if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?\(pane)") {
|
|
NSWorkspace.shared.open(url)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|