macOS client overlays, menus and notifications
This commit is contained in:
@@ -8,6 +8,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
var connection: Connection?
|
||||
private var quitting = false
|
||||
|
||||
func applicationDidFinishLaunching(_ notification: Notification) {
|
||||
Notifier.shared.install()
|
||||
}
|
||||
|
||||
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||
false
|
||||
}
|
||||
|
||||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
|
||||
guard let store = connection?.store, !quitting else {
|
||||
return .terminateNow
|
||||
@@ -57,6 +65,24 @@ struct ByreApp: App {
|
||||
}
|
||||
}
|
||||
PasteboardCommands()
|
||||
CommandMenu("Go") {
|
||||
goButton("Switch Task", "k")
|
||||
goButton("Project", "p")
|
||||
goButton("Lead", "l")
|
||||
goButton("Merge", "s")
|
||||
Divider()
|
||||
goButton("Keyboard Shortcuts", "/")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func goButton(_ label: String, _ key: String) -> some View {
|
||||
Button(label) {
|
||||
if let store = connection.store {
|
||||
runGo(key, store, overlays)
|
||||
}
|
||||
}
|
||||
.keyboardShortcut(KeyEquivalent(Character(key)))
|
||||
.disabled(connection.store == nil || overlays.isOpen)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user