libinput-dotnet
1.30.4
dotnet add package libinput-dotnet --version 1.30.4
NuGet\Install-Package libinput-dotnet -Version 1.30.4
<PackageReference Include="libinput-dotnet" Version="1.30.4" />
<PackageVersion Include="libinput-dotnet" Version="1.30.4" />
<PackageReference Include="libinput-dotnet" />
paket add libinput-dotnet --version 1.30.4
#r "nuget: libinput-dotnet, 1.30.4"
#:package libinput-dotnet@1.30.4
#addin nuget:?package=libinput-dotnet&version=1.30.4
#tool nuget:?package=libinput-dotnet&version=1.30.4
libinput-dotnet
.NET bindings for libinput
Usage
using Libinput;
using Udev;
using var udev = new UdevContext();
using var context = LibinputContext.CreateUdevContext(udev);
context.AssignSeat("seat0");
while (true)
{
context.Dispatch();
foreach (var ev in context.Events())
{
using (ev)
{
switch (ev)
{
case LibinputKeyboardEvent key:
Console.WriteLine($"key {key.Key} {key.KeyState}");
break;
case LibinputPointerMotionEvent motion:
Console.WriteLine($"motion {motion.Dx}/{motion.Dy}");
break;
}
}
}
context.Wait(); // poll(2) on context.Fd
}
Or manage devices explicitly with the path backend:
using var context = LibinputContext.CreatePathContext();
using var device = context.AddDevice("/dev/input/event3");
device.Config.Tap.Enabled = true;
The context is poll-style and never starts threads; integrate context.Fd into any event loop and call Dispatch when it is readable.
Permissions
libinput opens evdev nodes through an open/close callback pair so that access can be routed through a seat manager. By default the binding uses LibinputDirectInterface, which calls open(2) directly and requires permission on /dev/input/event* (root, the input group, or a udev rule). To integrate with systemd-logind or seatd instead, implement ILibinputInterface and pass it to the context factory.
Requirements
libinput.so.10(libinput ≥ 1.21; the wrapper targets 1.30) installed via your distribution.libudev.so.1for the udev backend.
Building
dotnet build # solution: Libinput.NET.slnx
dotnet test # needs libinput.so.10; uinput for the integration tests
dotnet run --project samples/Libinput.NET.Sample # watch seat0
dotnet run --project samples/Libinput.NET.Sample -- /dev/input/event3
The integration tests create virtual devices through /dev/uinput and inject real events; they skip when /dev/uinput or the created nodes are not accessible.
Regenerating the native bindings
src/Libinput.NET/Native/Generated/** is checked in, so consumers never need clang. To regenerate after bumping the external/libinput submodule:
git submodule update --init
dotnet tool restore
sh eng/generate.sh
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- udev-dotnet (>= 261.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.30.4 | 511 | 7/28/2026 |