You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -23,11 +25,26 @@ class WoxQueryBoxView extends GetView<WoxLauncherController> {
23
25
onKeyEvent: (FocusNode node, KeyEvent event) {
24
26
var isAnyModifierPressed =WoxHotkey.isAnyModifierPressed();
25
27
if (!isAnyModifierPressed) {
28
+
// handle escape key
29
+
// On Windows, the keydown and keyup events are triggered sequentially (strange behavior but true). If you only listen for the keydown event individually,
30
+
// it will require pressing the Esc key twice for the keydown event to be captured.
31
+
//
32
+
// Solution:
33
+
// 1. Listen for both keydown and keyup events
34
+
// 2. Debounce the hide app action to prevent it from being called multiple times
35
+
if (event isKeyDownEvent|| event isKeyUpEvent) {
36
+
if (event.logicalKey ==LogicalKeyboardKey.escape) {
37
+
int currentTimestamp =DateTime.now().millisecondsSinceEpoch;
38
+
if (currentTimestamp - _lastHideAppTimestamp >300) {
0 commit comments