Feature: Support command+w to close dashboard
This commit is contained in:
parent
71ddd619e4
commit
16c087a56d
@ -49,6 +49,11 @@ class ClashWebViewContoller: NSViewController {
|
||||
}.disposed(by: disposeBag)
|
||||
|
||||
loadWebRecourses()
|
||||
|
||||
NSEvent.addLocalMonitorForEvents(matching: .keyDown) {[weak self] in
|
||||
self?.keyDown(with: $0)
|
||||
return $0
|
||||
}
|
||||
}
|
||||
|
||||
func loadWebRecourses() {
|
||||
@ -83,6 +88,15 @@ class ClashWebViewContoller: NSViewController {
|
||||
NSApp.setActivationPolicy(.accessory)
|
||||
}
|
||||
|
||||
override func keyDown(with event: NSEvent) {
|
||||
switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
|
||||
case [.command] where event.characters == "w":
|
||||
self.view.window?.close()
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user