From 8de1c69dbbb2b185652cea496189f806856384d8 Mon Sep 17 00:00:00 2001 From: pancakes
Date: Tue, 26 Aug 2025 01:30:08 +1000 Subject: [PATCH] Add layer shell window --- DeltatuneWls/Program.cs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/DeltatuneWls/Program.cs b/DeltatuneWls/Program.cs index e5dff12..84b7a42 100644 --- a/DeltatuneWls/Program.cs +++ b/DeltatuneWls/Program.cs @@ -1,3 +1,28 @@ -// See https://aka.ms/new-console-template for more information +using Gio; +using Gtk; +using ZwlrLayerShell; +using Application = Gtk.Application; -Console.WriteLine("Hello, World!"); \ No newline at end of file +if (!LayerShell.IsSupported()) +{ + Console.WriteLine("You must be running on a Wayland compositor that supports zwlr_layer_shell_v1"); + return 255; +} + +var application = Application.New("gay.pancakes.deltatune_wls", Gio.ApplicationFlags.FlagsNone); + +application.OnActivate += (sender, eventArgs) => +{ + var window = ApplicationWindow.New((Application)sender); + + LayerShell.InitForWindow(window); + LayerShell.SetNamespace(window, "deltatune-wls"); + LayerShell.SetLayer(window, Layer.Top); + LayerShell.SetAnchor(window, Edge.Left, true); + LayerShell.SetAnchor(window, Edge.Top, true); + LayerShell.SetMargin(window, 15); + + window.Present(); +}; + +return application.RunWithSynchronizationContext(null); \ No newline at end of file