Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DviZe.Win.Hotkeys

A .NET 10 class library for registering global hotkeys in console and non-UI applications.

Designed to work alongside MessagePump and HiddenWindow from DviZe.Win.Common, which provide the Win32 message loop and window handle needed to receive hotkey events.

using Kwerty.DviZe.Win;
using Kwerty.DviZe.Win.Hotkeys;

await using var hotkeyListener = new HotkeyListener(hiddenWindow, messagePump.ThreadAccessor, loggerFactory);

var subscription = await hotkeyListener.SubscribeAsync(
    HotkeyModifiers.Control | HotkeyModifiers.Alt,
    Key.K,
    evt => Console.WriteLine($"Hotkey pressed: {evt.Modifiers}+{evt.Key}"), 
    cancellationToken);

subscription.Dispose(); // Unsubscribe.

See ExampleApp1 for a more structured example with dependency injection.

About

A .NET 10 class library for registering global hotkeys in console and non-UI applications.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages