30 lines
1007 B
C#
30 lines
1007 B
C#
namespace CursorLang.Core.Services;
|
|
|
|
/// <summary>
|
|
/// Intercepts Caps Lock at the system level and splits the presses into short and
|
|
/// long ones. What to do with them is up to the subscribers.
|
|
/// </summary>
|
|
public interface ICapsLockHotkeyService
|
|
{
|
|
/// <summary>A short press: the key was released before the hold threshold.</summary>
|
|
event EventHandler? Tapped;
|
|
|
|
/// <summary>The hold threshold has passed, the key is still held.</summary>
|
|
event EventHandler? HoldStarted;
|
|
|
|
/// <summary>The hold is over: the key was released.</summary>
|
|
event EventHandler? HoldEnded;
|
|
|
|
/// <summary>Whether the hook is installed right now.</summary>
|
|
bool IsRunning { get; }
|
|
|
|
/// <summary>
|
|
/// Starts intercepting. Must be called from the user interface thread:
|
|
/// a system keyboard hook works only on a thread with a message loop.
|
|
/// </summary>
|
|
void Start();
|
|
|
|
/// <summary>Removes the hook, giving the key its usual behaviour back.</summary>
|
|
void Stop();
|
|
}
|