This release contains multiple breaking changes, new features, and bug fixes. View the migration guide for upgrade guidelines.
Breaking Changes
-
When running on Wayland, SharpHook doesn't use X11 APIs by default anymore.
-
SharpHook now provides 4 libuiohook binaries on Linux - libuiohook.so, libuiohook-xrecord.so, libuiohook-x11.so, and libuiohook-wayland.so – all 4 should generally be packaged with your application.
-
The
UioHookclass is now internal –UioHookProvider.Instanceshould be used instead. -
TestGlobalHook,TestProvider, andTestThreadingModewere moved to the separate SharpHook.Testing package. -
KeyTypedevents are disabled by default now. -
All classes and interfaces related to event simulation were moved to the
SharpHook.Simulationnamespace. -
IEventSimulatoris now disposable, and instances ofEventSimulatormust be disposed after usage. -
EventSimulator.Createshould be used instead ofnew EventSimulator(). -
EventSimulationSequenceBuilderandEventSimulationSequenceTemplatenow acceptEventSimulatorinstead ofIEventSimulationProviderin their constructors. -
IReactiveGlobalHookandIReactiveLogSourcewere moved from SharpHook.Reactive to SharpHook, but they retain their namespace. -
Delegates from
SharpHook.Nativewere moved toSharpHook.Data. The former namespace does not exist anymore. -
GetAutoRepeatRateandGetAutoRepeatDelaywere moved fromIMouseInfoProviderinto a newIKeyboardInfoProvider. -
Many values across multiple enums in
SharpHook.Datawere changed, in particular,KeyCode. -
EventTypeis nowushort.MouseMovedRelativeToCursorwas renamed toMouseMovedRelative.MouseDraggedRelativewas added. -
KeyCode:Vc102was renamed toVcSection.VcKanjiandVcHangulwere removed – useVcHanjaandVcKanarespectively instead. -
UioHookResult:ErrorPostTextNullwas removed andErrorNullshould be used instead. -
globalHookTypeandrunAsyncOnBackgroundThreadwere dropped from global hook constructors. Instead,globalHookTypeanduseBackgroundThreadshould be passed directly into theRunandRunAsyncmethods. -
Constructors in
EventSimulator,TestGlobalHook, andTestProviderwere merged to use a parameter with a default value instead of 2 different constructors. -
IEventSimulator.TextSimulationDelayOnX11andIEventSimulationProvider.PostTextDelayX11were renamed toTextSimulationDelayOnLinuxandPostTextDelayLinuxrespectively. -
All method parameters named
ethat had the type ofUioHookEventwere renamed to@event. -
The static
HookEventArgs.FromEventmethod was removed as it was unused.
New Features
-
SharpHook has support for Wayland now, though several features are limited or missing. It also requires elevated privileges on Wayland.
-
It's possible to select a Linux backend of libuohook through
ILinuxBackendProvider. -
SharpHook.ReactiveUI – a new package for integration with ReactiveUI.Primitives was added.
-
Support for features that are not available on all platforms can now be queried using
IFeatureProvider. -
Relative mouse movement events were added to global hooks. These events are only raised on Wayland.
-
EventLoopGlobalHookcan now make its event loop thread a background thread.
Bug Fixes
-
EventSimulationSequenceBuilderandEventSimulationSequenceTemplatedon't accept events of typeKeyTypedandMouseClickedanymore – simulating these events was always invalid in libuiohook. -
Mouse wheel event rotation values were fixed on Windows and Linux again.
-
Logging support was fixed on Linux on ARM64
Other Changes
-
libuiohook is now at version 2.0.0. This release and future releases of SharpHook will use libuiohook tags instead of raw commits.
-
Observable sequences are not disposed anymore when reactive hooks are disposed, they are only completed.
-
Mouse wheel rotation now uses multiples of 120 on Linux, like on Windows, instead of multiples of 100.
-
The field order in
UioHookEventandMouseWheelEventDatawas changed to makeUioHookEventtake up less space in memory. -
Calling
base.BeforeRunandbase.AfterStopin custom global hooks is not being recommended anymore. -
Explicit support for .NET 8 and .NET 9 was dropped, but it's still available via .NET Standard.
-
net10.0-maccatalystwas dropped as a TFM from SharpHook.Reactive and SharpHook.R3, as it's not needed for them. -
SharpHook.Reactive now uses Rx.NET 7, SharpHook.R3 now uses R3 1.3.1.