[gnome-shell/benzea/systemd-scopes-stable: 2/3] util: Place spawned processes into a systemd scope



commit 7be1729cde8d18412f7ba4f67364cd6df5253937
Author: Benjamin Berg <bberg redhat com>
Date:   Wed Nov 27 16:35:45 2019 +0100

    util: Place spawned processes into a systemd scope
    
    This improves the separation from the shell for applications launched
    with Alt+F2 and in a few other cases.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/863
    (cherry picked from commit 4a6c2f1fe65debc79451ee123b73c5e5597e6b6d)

 js/misc/util.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/js/misc/util.js b/js/misc/util.js
index db3742eb3d..2110602303 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -3,7 +3,7 @@
             formatTime, formatTimeSpan, createTimeLabel, insertSorted,
             makeCloseButton, ensureActorVisibleInScrollView */
 
-const { Clutter, Gio, GLib, GObject, Shell, St } = imports.gi;
+const { Clutter, Gio, GLib, GObject, Shell, St, GnomeDesktop } = imports.gi;
 const Gettext = imports.gettext;
 
 const Main = imports.ui.main;
@@ -127,6 +127,14 @@ function trySpawn(argv) {
             throw err;
         }
     }
+
+    // Async call, we don't need the reply though
+    try {
+        GnomeDesktop.start_systemd_scope(argv[0], pid, null, null, null, () => {});
+    } catch (err) {
+        // Ignore error; it likely means GnomeDesktop is too old
+    }
+
     // Dummy child watch; we don't want to double-fork internally
     // because then we lose the parent-child relationship, which
     // can break polkit.  See https://bugzilla.redhat.com//show_bug.cgi?id=819275


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]