diff --git a/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/NotificationSettingsDescriptor.java b/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/NotificationSettingsDescriptor.java index 19a8a64e..afe9e25c 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/NotificationSettingsDescriptor.java +++ b/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/NotificationSettingsDescriptor.java @@ -13,7 +13,7 @@ public class NotificationSettingsDescriptor implements Serializable { private boolean outNotificationEnable = true; private boolean scannerNotificationEnable = true; private boolean whisperHelperEnable = false; - private HotKeyDescriptor whisperHelperHotKey = new HotKeyDescriptor("Ctrl", 29, false, false, true); + private HotKeyDescriptor whisperHelperHotKey = new HotKeyDescriptor("F2", 60, false, false, false); private int limitCount = 3; private int unfoldCount = 2; private FlowDirections flowDirections = FlowDirections.DOWNWARDS; diff --git a/app-core/src/main/java/com/mercury/platform/shared/hotkey/MercuryNativeKeyListener.java b/app-core/src/main/java/com/mercury/platform/shared/hotkey/MercuryNativeKeyListener.java index ba2a3e90..c615857c 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/hotkey/MercuryNativeKeyListener.java +++ b/app-core/src/main/java/com/mercury/platform/shared/hotkey/MercuryNativeKeyListener.java @@ -41,6 +41,9 @@ public void nativeKeyPressed(NativeKeyEvent nativeKeyEvent) { @Override public void nativeKeyReleased(NativeKeyEvent nativeKeyEvent) { + if (!this.block) { + MercuryStoreCore.hotKeyReleaseSubject.onNext(this.getDescriptor(nativeKeyEvent)); + } switch (nativeKeyEvent.getKeyCode()) { case 42: { shiftPressed = false; @@ -55,10 +58,6 @@ public void nativeKeyReleased(NativeKeyEvent nativeKeyEvent) { break; } } - if (!this.block) { - MercuryStoreCore.hotKeyReleaseSubject.onNext(this.getDescriptor(nativeKeyEvent)); - } - } @Override diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/NotificationSettingsPagePanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/NotificationSettingsPagePanel.java index c965aac4..7f416c04 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/NotificationSettingsPagePanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/NotificationSettingsPagePanel.java @@ -28,6 +28,7 @@ public class NotificationSettingsPagePanel extends SettingsPagePanel { private HotKeyGroup incHotkeyGroup; private HotKeyGroup outHotkeyGroup; + private HotKeyGroup whHotkeyGroup; private HotKeyGroup scannerHotkeyGroup; @Override @@ -42,6 +43,7 @@ public void onViewInit() { this.incHotkeyGroup = new HotKeyGroup(); this.outHotkeyGroup = new HotKeyGroup(); + this.whHotkeyGroup = new HotKeyGroup(); this.scannerHotkeyGroup = new HotKeyGroup(); JPanel whisperHelperPanel = this.adrComponentsFactory.getCounterPanel(this.getWhisperHelperPanel(), "Whisper helper:", AppThemeColor.ADR_BG, false); @@ -133,7 +135,9 @@ private JPanel getWhisperHelperPanel() { parametersPanel.add(this.componentsFactory.getTextLabel("Enabled:", FontStyle.REGULAR, 16)); parametersPanel.add(enableCheckbox); parametersPanel.add(this.componentsFactory.getTextLabel("Hotkey:", FontStyle.REGULAR, 16)); - parametersPanel.add(new HotKeyPanel(this.generalSnapshot.getWhisperHelperHotKey())); + HotKeyPanel hotKeyPanel = new HotKeyPanel(this.generalSnapshot.getWhisperHelperHotKey()); + this.whHotkeyGroup.registerHotkey(hotKeyPanel); + parametersPanel.add(hotKeyPanel); JPanel showcasePanel = this.componentsFactory.getJPanel(new BorderLayout(), AppThemeColor.ADR_BG); showcasePanel.add(this.componentsFactory.getTextLabel("When you release hotkey button clipboard content will be transferred to chat.", FontStyle.REGULAR, 16), BorderLayout.PAGE_START);