keyboard shortcut to cycle servers
This commit is contained in:
@@ -110,11 +110,23 @@ struct ByreCommands: Commands {
|
||||
goButton("Project", "p")
|
||||
goButton("Lead", "l")
|
||||
goButton("Merge", "s")
|
||||
serverButton("Previous Server", "[", -1)
|
||||
serverButton("Next Server", "]", 1)
|
||||
Divider()
|
||||
goButton("Keyboard Shortcuts", "/")
|
||||
}
|
||||
}
|
||||
|
||||
private func serverButton(_ label: String, _ key: Character, _ step: Int) -> some View {
|
||||
Button(label) {
|
||||
if let origin = Servers.shared.step(from: focus?.origin, by: step) {
|
||||
openWindow(id: "main", value: origin)
|
||||
}
|
||||
}
|
||||
.keyboardShortcut(KeyEquivalent(key))
|
||||
.disabled(Servers.shared.origins.isEmpty)
|
||||
}
|
||||
|
||||
private func goButton(_ label: String, _ key: String) -> some View {
|
||||
Button(label) {
|
||||
if let store = focus?.store, let overlays = focus?.overlays {
|
||||
|
||||
Reference in New Issue
Block a user