summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-10-12 16:29:02 +0000
committerAylur <[email protected]>2024-10-13 03:50:25 +0200
commitccdbe4d073cbc24deaf69c5e45c959fa33b87f12 (patch)
treecb952df315281e449fcd3b61ff7803d70ca0765f /core
parentec5c6c9acc418946bfe7f28ffdd4803c712b3b53 (diff)
feat: App window-toggled signal
Diffstat (limited to 'core')
-rw-r--r--core/src/astal.vala14
1 files changed, 14 insertions, 0 deletions
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
@@ -15,6 +15,9 @@ public class Application : Gtk.Application {
public signal void monitor_removed(Gdk.Monitor monitor);
[DBus (visible=false)]
+ public signal void window_toggled(Gtk.Window window);
+
+ [DBus (visible=false)]
public List<weak Gdk.Monitor> monitors {
owned get {
var display = Gdk.Display.get_default();
@@ -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);