Fix add button. Fix hotkeys in settings. Add Workspace hotkeys
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user