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

View File

@@ -9,17 +9,6 @@ struct TabBar: View {
var body: some View {
HStack(spacing: 0) {
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 2) {
ForEach(Array(workspace.tabs.enumerated()), id: \.element.id) { index, tab in
tabButton(for: tab, at: index)
}
}
.padding(.horizontal, 4)
}
Spacer()
Button {
workspace.newTab()
} label: {
@@ -31,6 +20,15 @@ struct TabBar: View {
.accessibilityIdentifier("notch.new-tab")
.buttonStyle(.plain)
.padding(.horizontal, 8)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 2) {
ForEach(Array(workspace.tabs.enumerated()), id: \.element.id) { index, tab in
tabButton(for: tab, at: index)
}
}
.padding(.horizontal, 4)
}
}
.frame(height: 28)
.background(.black)