Open jverkoey opened 1 month ago
I took at stab at this, first by attempting to add a button to the context menu with a keyboard shortcut here:
like so:
Button {
connect(to: item)
} label: {
Label("Connect", systemImage: "phone.connection.fill")
}
.buttonStyle(.borderless)
.keyboardShortcut(.downArrow, modifiers: .command)
But this didn't work. I just realized that this might be because the keyboard shortcut doesn't get a chance to be registered anywhere until the context menu itself appears. Sure enough, once the context menu appears, the shortcut works as expected.
Going to try registering the command in the app menu instead.
Also I found https://steipete.com/posts/fixing-keyboardshortcut-in-swiftui/ which seemed relevant at first but likely isn't :)
Adding
Button("Connect") {
print("Foo")
}
.keyboardShortcut(.downArrow, modifiers: .command)
to the server command menu group works as expected, but now I'm not sure how to wire this up to the connection logic from TrackerView
🤔.
Got it working. PR inbound!
When browsing servers, my natural inclination was to press Cmd+Down to try to connect to the server. Return works just as well, but I figured it might be a nice additional macOS-ism to support Cmd+Down.