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
TinyHotKey is a Windows HotKey handler with no dependency on Windows Forms or WPF that only listento specified key combinations. It usesRegisterHotKey from the Win32 API directly on a dedicatedthread using a hidden window, avoiding global hooks.
// Add TinyHotKey to your DI container with logging supportservices.AddTinyHotKey();// In a service with a dependency on ITinyHotKeyusingvarregistration=tinyHotKey.RegisterHotKey(Modifier.Control|Modifier.Alt,Key.D,()=>{Console.WriteLine("Ctrl+Alt+D detected");returnTask.CompletedTask;});
Why TinyHotKey?
Unlike other projects TinyHotKey has no dependency on Windows Form or WPF and does not use globalhooks, which makes it possible to avoid keylogger-like behavior and also support trimming and AOT.
It is possible to use TinyHotKey in alternate UI frameworks such as Avalonia or even in consoleapplications.
How it works
The Windows hotkey mechanism works by detecting keyboard combinations and posting messages to aWindow. TinyHotKey creates a hidden Window on a dedicated thread using Win32 calls, handlingall hotkey interactions and invoking callbacks on a new task off the "UI" thread. This approachallows it to work in any kind of application running on Windows without relying on Windows Formsor WPF which are not trimming or AOT compatible.
About
Windows HotKey handler without dependency on keyboard hooks, Windows Forms, WPF.