Fix add button. Fix hotkeys in settings. Add Workspace hotkeys

This commit is contained in:
2026-03-13 17:25:00 +11:00
parent fe6c7d8c12
commit 1e30e9bf9e
17 changed files with 232 additions and 50 deletions

View File

@@ -76,9 +76,7 @@ struct HotkeyRecorderField: NSViewRepresentable {
}
func updateNSView(_ nsView: HotkeyNSView, context: Context) {
nsView.currentLabel = binding.displayString
nsView.showRecording = isRecording
nsView.needsDisplay = true
nsView.update(currentLabel: binding.displayString, isRecording: isRecording)
}
}
@@ -99,9 +97,7 @@ struct OptionalHotkeyRecorderField: NSViewRepresentable {
}
func updateNSView(_ nsView: HotkeyNSView, context: Context) {
nsView.currentLabel = binding?.displayString ?? "Not set"
nsView.showRecording = isRecording
nsView.needsDisplay = true
nsView.update(currentLabel: binding?.displayString ?? "Not set", isRecording: isRecording)
}
}
@@ -183,6 +179,12 @@ class HotkeyNSView: NSView {
updateLabelAppearance()
}
func update(currentLabel: String, isRecording: Bool) {
self.currentLabel = currentLabel
showRecording = isRecording
updateLabelAppearance()
}
private func updateLabelAppearance() {
label.stringValue = showRecording ? "Press keys..." : currentLabel
label.textColor = showRecording ? .controlAccentColor : .labelColor