using Moli.Desktop.Hotkeys; namespace Moli.Desktop.Runtime; public enum HotkeyRegistrationState { Registered, Conflict, Disabled, Invalid } public sealed record HotkeyRegistration { public required string BindingId { get; init; } public required string Keys { get; init; } public required HotkeyRegistrationState State { get; init; } public string? Detail { get; init; } } public interface IHotkeyService : IDisposable { event Func? HotkeyPressed; IReadOnlyList Registrations { get; } Task ReplaceBindingsAsync(IReadOnlyList bindings, CancellationToken cancellationToken = default); void Pause(); void Resume(); void UnregisterAll(); } public interface INativeHotkeyApi { bool Register(IntPtr hwnd, int id, uint modifiers, uint virtualKey, out int win32Error); bool Unregister(IntPtr hwnd, int id); } public interface IHotkeyMessageWindow : IDisposable { IntPtr Handle { get; } event Action? HotkeyPosted; void EnsureCreated(); }