From 00738c9383472b9fd83d65785215c5a97a58159f Mon Sep 17 00:00:00 2001 From: Aylur Date: Thu, 26 Sep 2024 00:32:03 +0000 Subject: add: python example bar --- examples/vala/simple-bar/app.in.vala | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'examples/vala/simple-bar/app.in.vala') diff --git a/examples/vala/simple-bar/app.in.vala b/examples/vala/simple-bar/app.in.vala index 1d61b3a..aece979 100644 --- a/examples/vala/simple-bar/app.in.vala +++ b/examples/vala/simple-bar/app.in.vala @@ -1,6 +1,11 @@ class App : Astal.Application { public static App instance; + public override void request (string msg, SocketConnection conn) { + print(@"$msg\n"); + Astal.write_sock.begin(conn, "hello"); + } + public override void activate () { foreach (var mon in this.monitors) add_window(new Bar(mon)); @@ -8,8 +13,17 @@ class App : Astal.Application { apply_css("@STYLE@"); } - public static int main() { - App.instance = new App(); - return App.instance.run(null); + public static void main(string[] args) { + var instance_name = "simple-bar"; + + App.instance = new App() { + instance_name = instance_name + }; + + if (App.instance.acquire_socket()) { + App.instance.run(null); + } else { + print(Astal.Application.send_message(instance_name, string.joinv(" ", args))); + } } } -- cgit v1.2.3