diff --git a/v2rayN/GlobalHotKeys b/v2rayN/GlobalHotKeys index 569a95bb..162d401d 160000 --- a/v2rayN/GlobalHotKeys +++ b/v2rayN/GlobalHotKeys @@ -1 +1 @@ -Subproject commit 569a95bb0fd2280d8d5581250aae54ecc2122d10 +Subproject commit 162d401dfe0140b41d1fa349b9aadb4060e739b1 diff --git a/v2rayN/v2rayN.Desktop/Manager/HotkeyManager.cs b/v2rayN/v2rayN.Desktop/Manager/HotkeyManager.cs index a79573d6..da3c4f27 100644 --- a/v2rayN/v2rayN.Desktop/Manager/HotkeyManager.cs +++ b/v2rayN/v2rayN.Desktop/Manager/HotkeyManager.cs @@ -8,6 +8,7 @@ public sealed class HotkeyManager private static readonly Lazy _instance = new(() => new()); public static HotkeyManager Instance = _instance.Value; private readonly Dictionary _hotkeyTriggerDic = new(); + [SupportedOSPlatform("windows")] private GlobalHotKeys.HotKeyManager? _hotKeyManager; @@ -74,9 +75,7 @@ public sealed class HotkeyManager } } - _hotKeyManager?.HotKeyPressed - .ObserveOn(AvaloniaScheduler.Instance) - .Subscribe(OnNext); + _hotKeyManager.HotKeyPressed += OnNext; } private void OnNext(HotKey key) diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs index 15c47b05..1f6b79d9 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs @@ -257,7 +257,7 @@ public partial class MainWindow : WindowBase switch (e) { case EGlobalHotkey.ShowForm: - ShowHideWindow(null); + Dispatcher.UIThread.Post(() => ShowHideWindow(null)); break; case EGlobalHotkey.SystemProxyClear: