WaylandSharpest 1.27.2

dotnet add package WaylandSharpest --version 1.27.2
                    
NuGet\Install-Package WaylandSharpest -Version 1.27.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WaylandSharpest" Version="1.27.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WaylandSharpest" Version="1.27.2" />
                    
Directory.Packages.props
<PackageReference Include="WaylandSharpest" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WaylandSharpest --version 1.27.2
                    
#r "nuget: WaylandSharpest, 1.27.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WaylandSharpest@1.27.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WaylandSharpest&version=1.27.2
                    
Install as a Cake Addin
#tool nuget:?package=WaylandSharpest&version=1.27.2
                    
Install as a Cake Tool

WaylandSharpest

WaylandSharpest, the sharpest of Wayland.

This is (another) .NET binding for libwayland, with a Roslyn source generator that turns wayland-protocol XML into idiomatic C# APIs.

Consuming protocols

Add the package and drop protocol XML into a wayland-protocols/ folder next to your project fil, where they will be picked up automatically, or declare items explicitly:

<ItemGroup>
  <PackageReference Include="WaylandSharpest" Version="..." />
  <WaylandProtocol Include="protocol/xdg-shell.xml" WaylandNamespace="My.Protocols" />
</ItemGroup>

The Generated code lands in your project's root namespace unless overridden with WaylandNamespace. References to interfaces from other protocols resolve against protocol XML in the same project first, then against referenced assemblies via the [WaylandProxy]/[WaylandResource] attributes.

Client example

using var display = WlDisplay.Connect();
using var registry = display.GetRegistry();

WlCompositor? compositor = null;
registry.Global += (_, e) =>
{
    if (e.Interface == "wl_compositor")
        compositor = registry.Bind<WlCompositor>(e.Name, e.Version);
};
display.Roundtrip();

using var surface = compositor!.CreateSurface();
surface.Commit();

There are no finalizers; Wayland objects must be destroyed from the dispatch thread, so leaks are your responsibility.

Server example

using var server = WlServerDisplay.Create();
var socket = server.AddSocketAuto();
using var global = server.CreateGlobal(WlCompositor.Interface, 6, (client, version, id) =>
{
    var compositor = new WlCompositorResource(client, version, id);
    compositor.CreateSurface += (_, e) => new WlSurfaceResource(client, version, e.Id);
});
server.Run();

Building and testing

dotnet build
dotnet test

# run the sample
weston --backend=headless --socket=demo &
WAYLAND_DISPLAY=demo dotnet run --project samples/ShmWindow

Regenerating the raw bindings after updating the wayland submodule requires the ClangSharpPInvokeGenerator dotnet tool and clang:

dotnet tool install --global ClangSharpPInvokeGenerator
eng/generate-native.sh
Product 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

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.27.2 83 9/17/2026
1.27.1 84 9/17/2026
1.27.0 104 9/1/2026
1.26.8 203 8/13/2026
1.26.6 135 8/11/2026
1.26.5 128 8/11/2026
1.26.4 316 8/2/2026
1.26.3 139 7/31/2026
1.26.2 120 7/28/2026
1.26.1 141 7/25/2026
1.26.0 115 7/25/2026