boolean (@NotNull AWTEvent event) { if (!(event instanceof KeyEvent keyEvent)) { return false; } Application application = ApplicationManager.getApplication(); if ((application != null && !application.isHeadlessEnvironment()) && KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow() == null) { return false; // on macOS, we can receive modifier key events even if app isn't in focus (e.g. when Spotlight popup is shown) } ModifierKeyDoubleClickHandler doubleClickHandler = getInstance(); boolean result = false; for (MyDispatcher dispatcher : doubleClickHandler.myDispatchers.values()) { if (dispatcher.dispatch(keyEvent)) { result = true; } } return result; }