Rebuild index with Command + Shift + R; also overhaul events.
This commit is contained in:
@@ -40,22 +40,32 @@ class PopoverPanel: NSPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func performKeyEquivalent(with event: NSEvent) -> Bool {
|
override func performKeyEquivalent(with event: NSEvent) -> Bool {
|
||||||
Self.logger.debug("performKeyEquivalent keyCode=\(event.keyCode)")
|
let modifiers = event.modifierFlags.rawValue
|
||||||
let commandKey = NSEvent.ModifierFlags.command.rawValue
|
let command = NSEvent.ModifierFlags.command.rawValue
|
||||||
|
let shift = NSEvent.ModifierFlags.shift.rawValue
|
||||||
|
let control = NSEvent.ModifierFlags.control.rawValue
|
||||||
|
let option = NSEvent.ModifierFlags.option.rawValue
|
||||||
|
|
||||||
if event.type == NSEvent.EventType.keyDown {
|
if event.type == NSEvent.EventType.keyDown {
|
||||||
if (event.modifierFlags.rawValue &
|
// Checks if flags contains a command key,
|
||||||
NSEvent.ModifierFlags.deviceIndependentFlagsMask.rawValue)
|
// then check if flags doesn't contain any other keys.
|
||||||
== commandKey, event.keyCode == 13 // W
|
if (modifiers & command) == command,
|
||||||
{
|
(modifiers & (control | shift | option)) == 0,
|
||||||
resignKey()
|
event.keyCode == 12 // Q
|
||||||
return true
|
|
||||||
} else if (event.modifierFlags.rawValue &
|
|
||||||
NSEvent.ModifierFlags.deviceIndependentFlagsMask.rawValue)
|
|
||||||
== commandKey, event.keyCode == 12 // Q
|
|
||||||
{
|
{
|
||||||
NSApplication.shared.terminate(self)
|
NSApplication.shared.terminate(self)
|
||||||
return true
|
return true
|
||||||
|
} else if (modifiers & command) == command,
|
||||||
|
(modifiers & (control | shift | option)) == 0,
|
||||||
|
event.keyCode == 13 // W
|
||||||
|
{
|
||||||
|
resignKey()
|
||||||
|
return true
|
||||||
|
} else if (modifiers & (command & shift)) == command & shift,
|
||||||
|
(modifiers & (control | option)) == 0,
|
||||||
|
event.keyCode == 15 // R
|
||||||
|
{
|
||||||
|
PathManager.shared.rebuildIndex()
|
||||||
} else if event.keyCode == 53 { // ESC
|
} else if event.keyCode == 53 { // ESC
|
||||||
resignKey()
|
resignKey()
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user