Blob Blame History Raw
From eea9b9a0dac494698a64892bab8d042e7d623c9f Mon Sep 17 00:00:00 2001
From: Cenk Uluisik <cenk.uluisik@googlemail.com>
Date: Sun, 6 Mar 2022 19:32:48 +0100
Subject: [PATCH] introspect: Add WindowsChanged signal

The screencast portal supports recording a single window,
and presents a list of open windows when that option is
selected. To allow updating that list when windows are
opened or closed, add a new "WindowsChanged" signal that
the portal can listen to.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2229>
---
 data/dbus-interfaces/org.gnome.Shell.Introspect.xml | 6 ++++++
 js/misc/introspect.js                               | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/data/dbus-interfaces/org.gnome.Shell.Introspect.xml b/data/dbus-interfaces/org.gnome.Shell.Introspect.xml
index 47fd7efdc2..cb19cfec56 100644
--- a/data/dbus-interfaces/org.gnome.Shell.Introspect.xml
+++ b/data/dbus-interfaces/org.gnome.Shell.Introspect.xml
@@ -18,6 +18,12 @@
     -->
     <signal name="RunningApplicationsChanged" />
 
+    <!--
+        WindowsChanged:
+        @short_description: Notifies when any window opens or closes
+    -->
+    <signal name="WindowsChanged" />
+
     <!--
         GetRunningApplications:
         @short_description: Retrieves the description of all running applications
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
index 45eee81ce3..8916804e7f 100644
--- a/js/misc/introspect.js
+++ b/js/misc/introspect.js
@@ -42,6 +42,9 @@ var IntrospectService = class {
                             this._syncRunningApplications();
                         });
 
+        tracker.connect('tracked-windows-changed',
+            () => this._dbusImpl.emit_signal('WindowsChanged', null));
+
         this._syncRunningApplications();
 
         this._senderChecker = new DBusSenderChecker(APP_ALLOWLIST);
-- 
2.38.1