Synchronize GlobalHotKeys library and update HotKeyManager

This commit is contained in:
2dust
2026-07-06 16:07:42 +08:00
parent 52766d66bf
commit 66b48c231f
3 changed files with 4 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ public sealed class HotkeyManager
private static readonly Lazy<HotkeyManager> _instance = new(() => new());
public static HotkeyManager Instance = _instance.Value;
private readonly Dictionary<int, EGlobalHotkey> _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)

View File

@@ -257,7 +257,7 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
switch (e)
{
case EGlobalHotkey.ShowForm:
ShowHideWindow(null);
Dispatcher.UIThread.Post(() => ShowHideWindow(null));
break;
case EGlobalHotkey.SystemProxyClear: