ZwlrLayerShell/README.md

43 lines
No EOL
1.3 KiB
Markdown

# 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.
```csharp
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);
```
[Gir.Core]: https://gircore.github.io/
[gtk4-layer-shell]: https://github.com/wmww/gtk4-layer-shell
[zwlr_layer_shell_v1]: https://wayland.app/protocols/wlr-layer-shell-unstable-v1