C# bindings for the gtk4-layer-shell library for use with Gir.Core GTK
Find a file
2025-08-25 20:36:17 +10:00
.idea/.idea.ZwlrLayerShell/.idea Initial commit 2025-08-25 20:02:31 +10:00
ZwlrLayerShell Initial commit 2025-08-25 20:02:31 +10:00
.gitignore Initial commit 2025-08-25 20:02:31 +10:00
LICENSE Add README.md and LICENSE 2025-08-25 20:36:17 +10:00
README.md Add README.md and LICENSE 2025-08-25 20:36:17 +10:00
ZwlrLayerShell.sln Initial commit 2025-08-25 20:02:31 +10:00

ZwlrLayerShell

C# bindings for the gtk4-layer-shell library intended to be used with Gir.Core's GTK4 package. This package can be used to create applications such as panels and widgets through the zwlr_layer_shell_v1 protocol.

Usage

ZwlrLayerShell can be used the same way as gtk4-layer-shell is used in C. Please note that you need to link it before libwayland-client to function correctly. The following example uses the LayerShell.IsSupported() function to make sure it is linked beforehand.

using Gtk;
using ZwlrLayerShell;

if (!LayerShell.IsSupported())
{
    // Exit the program if the compositor doesn't support zwlr_layer_shell_v1
    return;
}

var application = Application.New("com.example.exampleapp", Gio.ApplicationFlags.FlagsNone);

application.OnActivate += (sender, eventArgs) =>
{
    var window = ApplicationWindow.New((Application)sender);

    // Window must be assigned the layer_surface role before being presented
    LayerShell.InitForWindow(window);
    LayerShell.SetNamespace(window, "exampleapp");
    LayerShell.SetLayer(window, Layer.Top);

    window.Present();
};

application.RunWithSynchronizationContext(null);