From ccdbe4d073cbc24deaf69c5e45c959fa33b87f12 Mon Sep 17 00:00:00 2001 From: Aylur Date: Sat, 12 Oct 2024 16:29:02 +0000 Subject: feat: App window-toggled signal --- core/src/astal.vala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'core/src') diff --git a/core/src/astal.vala b/core/src/astal.vala index 134293b..176062f 100644 --- a/core/src/astal.vala +++ b/core/src/astal.vala @@ -14,6 +14,9 @@ public class Application : Gtk.Application { [DBus (visible=false)] public signal void monitor_removed(Gdk.Monitor monitor); + [DBus (visible=false)] + public signal void window_toggled(Gtk.Window window); + [DBus (visible=false)] public List monitors { owned get { @@ -252,6 +255,17 @@ public class Application : Gtk.Application { }); }); + window_added.connect((window) => { + ulong id1, id2; + id1 = window.notify["visible"].connect(() => window_toggled(window)); + id2 = window_removed.connect((removed) => { + if (removed == window) { + window.disconnect(id1); + this.disconnect(id2); + } + }); + }); + shutdown.connect(() => { try { quit(); } catch(Error err) {} }); Unix.signal_add(1, () => { try { quit(); } catch(Error err) {} }, Priority.HIGH); Unix.signal_add(2, () => { try { quit(); } catch(Error err) {} }, Priority.HIGH); -- cgit v1.2.3