[gnome-session/benzea/systemd-gnome-launched-drop-in] autostart-app: Place launched applications into a systemd scope



commit e8329893decc64576b45e6c56f7fad52f6819e7a
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Nov 28 14:56:30 2019 +0100

    autostart-app: Place launched applications into a systemd scope
    
    Try to place launched applications into a systemd scope. This will only
    have an effect on systemd managed sessions, where it will e.g. protect
    gnome-session from OOM actions to a child resulting in a service
    shutdown.

 gnome-session/gsm-autostart-app.c | 10 ++++++++++
 meson.build                       |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/gnome-session/gsm-autostart-app.c b/gnome-session/gsm-autostart-app.c
index 6fd5915a..0893300b 100644
--- a/gnome-session/gsm-autostart-app.c
+++ b/gnome-session/gsm-autostart-app.c
@@ -28,6 +28,9 @@
 #include <gio/gio.h>
 #include <gio/gdesktopappinfo.h>
 
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnome-desktop/gnome-systemd.h>
+
 #ifdef HAVE_SYSTEMD
 #ifdef ENABLE_SYSTEMD_JOURNAL
 #include <systemd/sd-journal.h>
@@ -960,6 +963,13 @@ app_launched (GAppLaunchContext *ctx,
         g_variant_lookup (platform_data, "startup-notification-id", "s", &sn_id);
         app->priv->pid = pid;
         app->priv->startup_id = sn_id;
+
+        /* We are not interested in the result. */
+        gnome_start_systemd_scope (app->priv->desktop_id,
+                                   pid,
+                                   NULL,
+                                   NULL,
+                                   NULL, NULL, NULL);
 }
 
 #ifdef ENABLE_SYSTEMD_JOURNAL
diff --git a/meson.build b/meson.build
index 3205c33f..5543d52c 100644
--- a/meson.build
+++ b/meson.build
@@ -103,7 +103,7 @@ x11_dep = dependency('x11')
 session_deps = [
   gio_dep,
   glib_dep,
-  dependency('gnome-desktop-3.0', version: '>= 3.18.0'),
+  dependency('gnome-desktop-3.0', version: '>= 3.34.2.1'),
   dependency('json-glib-1.0', version: '>= 0.10')
 ]
 


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