[gnome-settings-daemon/wip/benzea/systemd-user] plugins: Add systemd user service files for all the plugins



commit b7a63086dad70e02f5a0fbda96deacaba06b0cdf
Author: Benjamin Berg <bberg redhat com>
Date:   Sat Apr 20 00:39:15 2019 +0200

    plugins: Add systemd user service files for all the plugins
    
    Using the facility added in the previous commit, we can add systemd user
    service files for all plugins and know when they have started up.
    
    This is roughly based on the work previously done by Iain Lane
    <iain orangesquash org uk> and Bastien Nocera hadess hadess net>.
    
    For each g-s-d process we have a service and a target file. This
    separation only exists to contain dependency failures which would cause
    an OnFailure action to trigger and is needed so that we can use
    OnFailure for the gnome-session fail-whale
    (gnome-session-failed.target).
    
    In general, the approach taken is that we start g-s-d processes after
    gnome-session-initialized.target and before gnome-session.target.
    
    We want to be able to selectively start the services only when one or
    more dependencies are there, or even mask out services under some
    conditions. The approach taken is the following:
     * To mask a service, use a Conflicts entry. This is e.g. used to not
       start certain services in GDM using
         Conflicts=gnome-session@gnome-login.target
     * To depend on multiple targets to be up and running to start, we set
       each of these targets in Requisite/After/PartOf/WantedBy. We always
       do this for nome-session-initialized.target but this method is
       extensible to any number of further targets (e.g. bluetooth.target)

 meson.build                                        | 15 +++++++
 meson_options.txt                                  |  1 +
 plugins/a11y-settings/gsd-a11y-settings.service.in | 17 ++++++++
 plugins/a11y-settings/gsd-a11y-settings.target.in  | 12 ++++++
 ...rg.gnome.SettingsDaemon.A11ySettings.desktop.in |  1 +
 plugins/clipboard/gsd-clipboard.service.in         | 17 ++++++++
 plugins/clipboard/gsd-clipboard.target.in          | 12 ++++++
 .../org.gnome.SettingsDaemon.Clipboard.desktop.in  |  1 +
 plugins/color/gsd-color.service.in                 | 18 ++++++++
 plugins/color/gsd-color.target.in                  | 12 ++++++
 .../org.gnome.SettingsDaemon.Color.desktop.in      |  1 +
 plugins/common/daemon-skeleton-gtk.h               | 49 +++------------------
 plugins/common/daemon-skeleton.h                   | 46 +++-----------------
 plugins/common/meson.build                         |  1 +
 plugins/datetime/gsd-datetime.service.in           | 17 ++++++++
 plugins/datetime/gsd-datetime.target.in            | 15 +++++++
 .../org.gnome.SettingsDaemon.Datetime.desktop.in   |  1 +
 plugins/dummy/gsd-dummy.service.in                 | 17 ++++++++
 plugins/dummy/gsd-dummy.target.in                  | 25 +++++++++++
 .../org.gnome.SettingsDaemon.Dummy.desktop.in      |  1 +
 plugins/housekeeping/gsd-housekeeping.service.in   | 17 ++++++++
 plugins/housekeeping/gsd-housekeeping.target.in    | 15 +++++++
 ...rg.gnome.SettingsDaemon.Housekeeping.desktop.in |  1 +
 plugins/keyboard/gsd-keyboard.service.in           | 17 ++++++++
 plugins/keyboard/gsd-keyboard.target.in            | 12 ++++++
 .../org.gnome.SettingsDaemon.Keyboard.desktop.in   |  1 +
 plugins/media-keys/gsd-media-keys.service.in       | 17 ++++++++
 plugins/media-keys/gsd-media-keys.target.in        | 12 ++++++
 .../org.gnome.SettingsDaemon.MediaKeys.desktop.in  |  1 +
 plugins/meson.build                                | 50 ++++++++++++++++++++--
 plugins/mouse/gsd-mouse.service.in                 | 17 ++++++++
 plugins/mouse/gsd-mouse.target.in                  | 12 ++++++
 .../org.gnome.SettingsDaemon.Mouse.desktop.in      |  1 +
 plugins/power/gsd-power.service.in                 | 17 ++++++++
 plugins/power/gsd-power.target.in                  | 12 ++++++
 .../org.gnome.SettingsDaemon.Power.desktop.in      |  1 +
 .../gsd-print-notifications.service.in             | 17 ++++++++
 .../gsd-print-notifications.target.in              | 12 ++++++
 ...me.SettingsDaemon.PrintNotifications.desktop.in |  1 +
 plugins/rfkill/gsd-rfkill.service.in               | 17 ++++++++
 plugins/rfkill/gsd-rfkill.target.in                | 12 ++++++
 .../org.gnome.SettingsDaemon.Rfkill.desktop.in     |  1 +
 .../gsd-screensaver-proxy.service.in               | 17 ++++++++
 .../gsd-screensaver-proxy.target.in                | 15 +++++++
 ...nome.SettingsDaemon.ScreensaverProxy.desktop.in |  1 +
 plugins/sharing/gsd-sharing.service.in             | 17 ++++++++
 plugins/sharing/gsd-sharing.target.in              | 15 +++++++
 .../org.gnome.SettingsDaemon.Sharing.desktop.in    |  1 +
 plugins/smartcard/gsd-smartcard.service.in         | 17 ++++++++
 plugins/smartcard/gsd-smartcard.target.in          | 19 ++++++++
 .../org.gnome.SettingsDaemon.Smartcard.desktop.in  |  1 +
 plugins/sound/gsd-sound.service.in                 | 17 ++++++++
 plugins/sound/gsd-sound.target.in                  | 16 +++++++
 .../org.gnome.SettingsDaemon.Sound.desktop.in      |  1 +
 plugins/wacom/gsd-wacom.service.in                 | 17 ++++++++
 plugins/wacom/gsd-wacom.target.in                  | 18 ++++++++
 .../org.gnome.SettingsDaemon.Wacom.desktop.in      |  1 +
 plugins/xsettings/gsd-xsettings.service.in         | 17 ++++++++
 plugins/xsettings/gsd-xsettings.target.in          | 18 ++++++++
 .../org.gnome.SettingsDaemon.XSettings.desktop.in  |  1 +
 60 files changed, 666 insertions(+), 85 deletions(-)
---
diff --git a/meson.build b/meson.build
index 78dd0ac2..d543362a 100644
--- a/meson.build
+++ b/meson.build
@@ -102,6 +102,18 @@ polkit_gobject_dep = dependency('polkit-gobject-1', version: '>= 0.114')
 upower_glib_dep = dependency('upower-glib', version: '>= 0.99.0')
 x11_dep = dependency('x11')
 
+enable_systemd = get_option('systemd')
+if enable_systemd
+  systemd_dep = dependency('systemd', required: false)
+  assert(systemd_dep.found(), 'Systemd support explicitly required, but systemd not found')
+
+  # XXX: Once https://github.com/systemd/systemd/issues/9595 is fixed and we can
+  # depend on this version, replace with something like:
+  #  systemduserunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir')
+  # and uncomment systemd_dep below
+  systemd_userunitdir = join_paths(gsd_prefix, 'lib', 'systemd', 'user')
+endif
+
 m_dep = cc.find_library('m')
 
 # ALSA integration (default enabled)
@@ -245,6 +257,9 @@ output += '        RFKill support:           ' + enable_rfkill.to_string() + '\n
 if enable_smartcard
   output += '        System nssdb:             ' + system_nssdb_dir + '\n'
 endif
+if enable_systemd
+  output += '        Systemd user unit dir:    ' + systemd_userunitdir + '\n'
+endif
 if enable_rfkill
   output += '        udev dir:                 ' + udev_dir + '\n'
 endif
diff --git a/meson_options.txt b/meson_options.txt
index 50bd1749..0e85a440 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,6 @@
 option('nssdb_dir', type: 'string', value: '', description: 'Absolute path to the system NSS database 
directory')
 option('udev_dir', type: 'string', value: '', description: 'Absolute path of the udev base directory')
+option('systemd', type: 'boolean', value: true, description: 'Enable systemd integration')
 
 option('alsa', type: 'boolean', value: true, description: 'build with ALSA support (not optional on Linux 
platforms)')
 option('gudev', type: 'boolean', value: true, description: 'build with gudev device support (not optional on 
Linux platforms)')
diff --git a/plugins/a11y-settings/gsd-a11y-settings.service.in 
b/plugins/a11y-settings/gsd-a11y-settings.service.in
new file mode 100644
index 00000000..2fa69d69
--- /dev/null
+++ b/plugins/a11y-settings/gsd-a11y-settings.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Accessibility settings
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-a11y-settings.target
+After=gsd-a11y-settings.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-a11y-settings
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/a11y-settings/gsd-a11y-settings.target.in 
b/plugins/a11y-settings/gsd-a11y-settings.target.in
new file mode 100644
index 00000000..32265275
--- /dev/null
+++ b/plugins/a11y-settings/gsd-a11y-settings.target.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=GNOME Accessibility settings
+
+BindsTo=gsd-a11y-settings.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/a11y-settings/org.gnome.SettingsDaemon.A11ySettings.desktop.in 
b/plugins/a11y-settings/org.gnome.SettingsDaemon.A11ySettings.desktop.in
index 2f0ac936..58f5c680 100644
--- a/plugins/a11y-settings/org.gnome.SettingsDaemon.A11ySettings.desktop.in
+++ b/plugins/a11y-settings/org.gnome.SettingsDaemon.A11ySettings.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/clipboard/gsd-clipboard.service.in b/plugins/clipboard/gsd-clipboard.service.in
new file mode 100644
index 00000000..49b932f7
--- /dev/null
+++ b/plugins/clipboard/gsd-clipboard.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Clipboard handler
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-clipboard.target
+After=gsd-clipboard.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-clipboard
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/clipboard/gsd-clipboard.target.in b/plugins/clipboard/gsd-clipboard.target.in
new file mode 100644
index 00000000..8949e24d
--- /dev/null
+++ b/plugins/clipboard/gsd-clipboard.target.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=GNOME Clipboard handler
+
+BindsTo=gsd-clipboard.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+[Install]
+WantedBy=gnome-session.target
diff --git a/plugins/clipboard/org.gnome.SettingsDaemon.Clipboard.desktop.in 
b/plugins/clipboard/org.gnome.SettingsDaemon.Clipboard.desktop.in
index a7ca15be..98d30087 100644
--- a/plugins/clipboard/org.gnome.SettingsDaemon.Clipboard.desktop.in
+++ b/plugins/clipboard/org.gnome.SettingsDaemon.Clipboard.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/color/gsd-color.service.in b/plugins/color/gsd-color.service.in
new file mode 100644
index 00000000..f6ea804c
--- /dev/null
+++ b/plugins/color/gsd-color.service.in
@@ -0,0 +1,18 @@
+[Unit]
+Description=GNOME Color management
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-color.target
+After=gsd-color.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-color
+Restart=on-failure
+BusName=@plugin_dbus_name@
+
diff --git a/plugins/color/gsd-color.target.in b/plugins/color/gsd-color.target.in
new file mode 100644
index 00000000..62cd61db
--- /dev/null
+++ b/plugins/color/gsd-color.target.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=GNOME Color management
+
+BindsTo=gsd-color.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/color/org.gnome.SettingsDaemon.Color.desktop.in 
b/plugins/color/org.gnome.SettingsDaemon.Color.desktop.in
index a9d72231..3bb5cb47 100644
--- a/plugins/color/org.gnome.SettingsDaemon.Color.desktop.in
+++ b/plugins/color/org.gnome.SettingsDaemon.Color.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/common/daemon-skeleton-gtk.h b/plugins/common/daemon-skeleton-gtk.h
index 6253c44c..87bafb3d 100644
--- a/plugins/common/daemon-skeleton-gtk.h
+++ b/plugins/common/daemon-skeleton-gtk.h
@@ -40,37 +40,6 @@ static GOptionEntry entries[] = {
         {NULL}
 };
 
-static const char *gdm_helpers[] = {
-       "a11y-keyboard",
-       "a11y-settings",
-       "clipboard",
-       "color",
-       "keyboard",
-       "media-keys",
-       "power",
-       "smartcard",
-       "sound",
-       "xsettings",
-       "wacom",
-};
-
-static gboolean
-should_run (void)
-{
-       const char *session_mode;
-       guint i;
-
-       session_mode = g_getenv ("GNOME_SHELL_SESSION_MODE");
-       if (g_strcmp0 (session_mode, "gdm") != 0)
-               return TRUE;
-
-       for (i = 0; i < G_N_ELEMENTS (gdm_helpers); i++) {
-               if (g_str_equal (PLUGIN_NAME, gdm_helpers[i]))
-                       return TRUE;
-       }
-       return FALSE;
-}
-
 static void
 respond_to_end_session (GDBusProxy *proxy)
 {
@@ -242,7 +211,7 @@ name_lost_cb (GDBusConnection *connection,
 int
 main (int argc, char **argv)
 {
-        GError  *error;
+        GError  *error = NULL;
         guint name_own_id;
 
         bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR);
@@ -291,14 +260,11 @@ main (int argc, char **argv)
         manager = NEW ();
        register_with_gnome_session ();
 
-       if (should_run ()) {
-               error = NULL;
-               if (!START (manager, &error)) {
-                       fprintf (stderr, "Failed to start: %s\n", error->message);
-                       g_error_free (error);
-                       exit (1);
-               }
-       }
+        if (!START (manager, &error)) {
+                fprintf (stderr, "Failed to start: %s\n", error->message);
+                g_error_free (error);
+                exit (1);
+        }
 
        name_own_id = g_bus_own_name (G_BUS_TYPE_SESSION,
                                      PLUGIN_DBUS_NAME,
@@ -311,8 +277,7 @@ main (int argc, char **argv)
 
         gtk_main ();
 
-       if (should_run ())
-               STOP (manager);
+        STOP (manager);
 
         g_object_unref (manager);
         g_bus_unown_name (name_own_id);
diff --git a/plugins/common/daemon-skeleton.h b/plugins/common/daemon-skeleton.h
index 49a3d930..40b7f149 100644
--- a/plugins/common/daemon-skeleton.h
+++ b/plugins/common/daemon-skeleton.h
@@ -43,36 +43,6 @@ static GOptionEntry entries[] = {
         {NULL}
 };
 
-static const char *gdm_helpers[] = {
-       "a11y-keyboard",
-       "a11y-settings",
-       "clipboard",
-       "color",
-       "keyboard",
-       "media-keys",
-       "power",
-       "smartcard",
-       "sound",
-       "xsettings"
-};
-
-static gboolean
-should_run (void)
-{
-       const char *session_mode;
-       guint i;
-
-       session_mode = g_getenv ("GNOME_SHELL_SESSION_MODE");
-       if (g_strcmp0 (session_mode, "gdm") != 0)
-               return TRUE;
-
-       for (i = 0; i < G_N_ELEMENTS (gdm_helpers); i++) {
-               if (g_str_equal (PLUGIN_NAME, gdm_helpers[i]))
-                       return TRUE;
-       }
-       return FALSE;
-}
-
 static void
 respond_to_end_session (GDBusProxy *proxy)
 {
@@ -268,14 +238,11 @@ main (int argc, char **argv)
         manager = NEW ();
        register_with_gnome_session (loop);
 
-       if (should_run ()) {
-               error = NULL;
-               if (!START (manager, &error)) {
-                       fprintf (stderr, "Failed to start: %s\n", error->message);
-                       g_error_free (error);
-                       exit (1);
-               }
-       }
+        if (!START (manager, &error)) {
+                fprintf (stderr, "Failed to start: %s\n", error->message);
+                g_error_free (error);
+                exit (1);
+        }
 
        name_own_id = g_bus_own_name (G_BUS_TYPE_SESSION,
                                      PLUGIN_DBUS_NAME,
@@ -288,8 +255,7 @@ main (int argc, char **argv)
 
         g_main_loop_run (loop);
 
-       if (should_run ())
-               STOP (manager);
+        STOP (manager);
 
         g_object_unref (manager);
         g_bus_unown_name (name_own_id);
diff --git a/plugins/common/meson.build b/plugins/common/meson.build
index 2f18c2c6..4c998824 100644
--- a/plugins/common/meson.build
+++ b/plugins/common/meson.build
@@ -41,3 +41,4 @@ libcommon_dep = declare_dependency(
   include_directories: common_inc,
   link_with: libcommon
 )
+
diff --git a/plugins/datetime/gsd-datetime.service.in b/plugins/datetime/gsd-datetime.service.in
new file mode 100644
index 00000000..9c150028
--- /dev/null
+++ b/plugins/datetime/gsd-datetime.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Date & Time handling
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-datetime.target
+After=gsd-datetime.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-datetime
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/datetime/gsd-datetime.target.in b/plugins/datetime/gsd-datetime.target.in
new file mode 100644
index 00000000..219bdc1c
--- /dev/null
+++ b/plugins/datetime/gsd-datetime.target.in
@@ -0,0 +1,15 @@
+[Unit]
+Description=GNOME Date & Time handling
+
+BindsTo=gsd-datetime.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+Conflicts=gnome-session@gnome-login.target
+Conflicts=gnome-session@gnome-initial-setup.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/datetime/org.gnome.SettingsDaemon.Datetime.desktop.in 
b/plugins/datetime/org.gnome.SettingsDaemon.Datetime.desktop.in
index ac99312f..59360167 100644
--- a/plugins/datetime/org.gnome.SettingsDaemon.Datetime.desktop.in
+++ b/plugins/datetime/org.gnome.SettingsDaemon.Datetime.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/dummy/gsd-dummy.service.in b/plugins/dummy/gsd-dummy.service.in
new file mode 100644
index 00000000..13517ed7
--- /dev/null
+++ b/plugins/dummy/gsd-dummy.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Settings Daemon dummy replacement plugin (@pluginname@)
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-dummy.target
+After=gsd-dummy.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-dummy --dummy-name=@pluginname@
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/dummy/gsd-dummy.target.in b/plugins/dummy/gsd-dummy.target.in
new file mode 100644
index 00000000..199817bb
--- /dev/null
+++ b/plugins/dummy/gsd-dummy.target.in
@@ -0,0 +1,25 @@
+[Unit]
+Description=GNOME Settings Daemon dummy replacement plugin (@pluginname@)
+
+BindsTo=gsd-dummy.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+# See require-started.target on how to require another unit to be already running
+# See dependency.target on how to start a dependency and require it to be present
+#
+#Requisite=require-started.target
+#After=require-started.target
+#PartOf=require-started.target
+#Requires=dependency.target
+#After=dependency.target
+#
+# Also add PartOf if this unit should be stopped together with dependency.target
+#PartOf=dependency.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
+#WantedBy=require-started.target
diff --git a/plugins/dummy/org.gnome.SettingsDaemon.Dummy.desktop.in 
b/plugins/dummy/org.gnome.SettingsDaemon.Dummy.desktop.in
index fa80c87d..0824cf37 100644
--- a/plugins/dummy/org.gnome.SettingsDaemon.Dummy.desktop.in
+++ b/plugins/dummy/org.gnome.SettingsDaemon.Dummy.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/housekeeping/gsd-housekeeping.service.in 
b/plugins/housekeeping/gsd-housekeeping.service.in
new file mode 100644
index 00000000..f56ec47d
--- /dev/null
+++ b/plugins/housekeeping/gsd-housekeeping.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Maintenance of expirable data
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-housekeeping.target
+After=gsd-housekeeping.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-housekeeping
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/housekeeping/gsd-housekeeping.target.in b/plugins/housekeeping/gsd-housekeeping.target.in
new file mode 100644
index 00000000..3ae5e571
--- /dev/null
+++ b/plugins/housekeeping/gsd-housekeeping.target.in
@@ -0,0 +1,15 @@
+[Unit]
+Description=GNOME Maintenance of expirable data
+
+BindsTo=gsd-housekeeping.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+Conflicts=gnome-session@gnome-login.target
+Conflicts=gnome-session@gnome-initial-setup.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/housekeeping/org.gnome.SettingsDaemon.Housekeeping.desktop.in 
b/plugins/housekeeping/org.gnome.SettingsDaemon.Housekeeping.desktop.in
index a557ff04..21139f95 100644
--- a/plugins/housekeeping/org.gnome.SettingsDaemon.Housekeeping.desktop.in
+++ b/plugins/housekeeping/org.gnome.SettingsDaemon.Housekeeping.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/keyboard/gsd-keyboard.service.in b/plugins/keyboard/gsd-keyboard.service.in
new file mode 100644
index 00000000..2430a304
--- /dev/null
+++ b/plugins/keyboard/gsd-keyboard.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Keyboard handling
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-keyboard.target
+After=gsd-keyboard.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-keyboard
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/keyboard/gsd-keyboard.target.in b/plugins/keyboard/gsd-keyboard.target.in
new file mode 100644
index 00000000..3a2cb7eb
--- /dev/null
+++ b/plugins/keyboard/gsd-keyboard.target.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=GNOME Keyboard handling
+
+BindsTo=gsd-keyboard.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/keyboard/org.gnome.SettingsDaemon.Keyboard.desktop.in 
b/plugins/keyboard/org.gnome.SettingsDaemon.Keyboard.desktop.in
index 9cf0fbd4..ac0f911c 100644
--- a/plugins/keyboard/org.gnome.SettingsDaemon.Keyboard.desktop.in
+++ b/plugins/keyboard/org.gnome.SettingsDaemon.Keyboard.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/media-keys/gsd-media-keys.service.in b/plugins/media-keys/gsd-media-keys.service.in
new file mode 100644
index 00000000..35b461a1
--- /dev/null
+++ b/plugins/media-keys/gsd-media-keys.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Media keys handling
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-media-keys.target
+After=gsd-media-keys.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-media-keys
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/media-keys/gsd-media-keys.target.in b/plugins/media-keys/gsd-media-keys.target.in
new file mode 100644
index 00000000..a28a2498
--- /dev/null
+++ b/plugins/media-keys/gsd-media-keys.target.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=GNOME Media keys handling
+
+BindsTo=gsd-media-keys.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/media-keys/org.gnome.SettingsDaemon.MediaKeys.desktop.in 
b/plugins/media-keys/org.gnome.SettingsDaemon.MediaKeys.desktop.in
index de53c3f1..626b1c0f 100644
--- a/plugins/media-keys/org.gnome.SettingsDaemon.MediaKeys.desktop.in
+++ b/plugins/media-keys/org.gnome.SettingsDaemon.MediaKeys.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/meson.build b/plugins/meson.build
index 5ff476a0..40c44d2a 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -33,31 +33,75 @@ endif
 
 plugins_conf = configuration_data()
 plugins_conf.set('libexecdir', gsd_libexecdir)
+if enable_systemd
+  plugins_conf.set('systemd_hidden', 'X-GNOME-Autostart-systemd=true')
+else
+  plugins_conf.set('systemd_hidden', '')
+endif
 
 plugins_deps = [libgsd_dep]
 
 plugins_cflags = ['-DGNOME_SETTINGS_LOCALEDIR="@0@"'.format(gsd_localedir)]
 
+enabled_plugins_file = []
+
 foreach plugin: [['common', '']] + enabled_plugins
   plugin_name = plugin[0]
-  plugin_dbus_name = plugin[1]
+  desktop = 'org.gnome.SettingsDaemon.@0@.desktop'.format(plugin[1])
+
+  if plugin[1] == '' # common or dummy
+    desktop_in_file = ''
+  else
+    desktop_in_file = files(join_paths(plugin_name, desktop + '.in'))
+  endif
+
+  enabled_plugins_file += [[plugin_name, plugin[1], desktop_in_file]]
+endforeach
+
+foreach plugin: enabled_plugins_file
+  plugin_name = plugin[0]
+  plugin_name_case = plugin[1]
+  plugin_dbus_name='org.gnome.SettingsDaemon.@0@'.format(plugin_name_case)
 
   cflags = [
     '-DG_LOG_DOMAIN="@0@-plugin"'.format(plugin_name),
     '-DPLUGIN_NAME="@0@"'.format(plugin_name),
-    '-DPLUGIN_DBUS_NAME="org.gnome.SettingsDaemon.@0@"'.format(plugin_dbus_name),
+    '-DPLUGIN_DBUS_NAME="@0@"'.format(plugin_dbus_name),
   ] + plugins_cflags
 
   if not ['common', 'dummy'].contains(plugin_name)
     desktop = 'org.gnome.SettingsDaemon.@0@.desktop'.format(plugin[1])
+    desktop_in_file = plugin[2]
+    user_target = 'gsd-@0@.target'.format(plugin_name)
+    user_service = 'gsd-@0@.service'.format(plugin_name)
+
+    unit_conf = configuration_data()
+    unit_conf.set('libexecdir', gsd_libexecdir)
+    unit_conf.set('plugin_dbus_name', plugin_dbus_name)
 
     configure_file(
-      input: join_paths(plugin_name, desktop + '.in'),
+      input: desktop_in_file,
       output: desktop,
       configuration: plugins_conf,
       install: true,
       install_dir: gsd_xdg_autostart
     )
+    if enable_systemd
+      configure_file(
+        input: join_paths(plugin_name, user_service + '.in'),
+        output: user_service,
+        configuration: unit_conf,
+        install: true,
+        install_dir: systemd_userunitdir
+     )
+      configure_file(
+        input: join_paths(plugin_name, user_target + '.in'),
+        output: user_target,
+        configuration: unit_conf,
+        install: true,
+        install_dir: systemd_userunitdir
+     )
+   endif
   endif
 
   subdir(plugin_name)
diff --git a/plugins/mouse/gsd-mouse.service.in b/plugins/mouse/gsd-mouse.service.in
new file mode 100644
index 00000000..e77b7b60
--- /dev/null
+++ b/plugins/mouse/gsd-mouse.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Mouse settings management
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-mouse.target
+After=gsd-mouse.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-mouse
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/mouse/gsd-mouse.target.in b/plugins/mouse/gsd-mouse.target.in
new file mode 100644
index 00000000..d3eaa5e4
--- /dev/null
+++ b/plugins/mouse/gsd-mouse.target.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=GNOME Mouse settings management
+
+BindsTo=gsd-mouse.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/mouse/org.gnome.SettingsDaemon.Mouse.desktop.in 
b/plugins/mouse/org.gnome.SettingsDaemon.Mouse.desktop.in
index fb4c7d3d..b565b1e5 100644
--- a/plugins/mouse/org.gnome.SettingsDaemon.Mouse.desktop.in
+++ b/plugins/mouse/org.gnome.SettingsDaemon.Mouse.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/power/gsd-power.service.in b/plugins/power/gsd-power.service.in
new file mode 100644
index 00000000..bf3f6eb2
--- /dev/null
+++ b/plugins/power/gsd-power.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Power management handling
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-power.target
+After=gsd-power.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-power
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/power/gsd-power.target.in b/plugins/power/gsd-power.target.in
new file mode 100644
index 00000000..ebd85e8a
--- /dev/null
+++ b/plugins/power/gsd-power.target.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=GNOME Power management handling
+
+BindsTo=gsd-power.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/power/org.gnome.SettingsDaemon.Power.desktop.in 
b/plugins/power/org.gnome.SettingsDaemon.Power.desktop.in
index 82d1505d..41c0848c 100644
--- a/plugins/power/org.gnome.SettingsDaemon.Power.desktop.in
+++ b/plugins/power/org.gnome.SettingsDaemon.Power.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/print-notifications/gsd-print-notifications.service.in 
b/plugins/print-notifications/gsd-print-notifications.service.in
new file mode 100644
index 00000000..ac2ff590
--- /dev/null
+++ b/plugins/print-notifications/gsd-print-notifications.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Printer notifications
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-print-notifications.target
+After=gsd-print-notifications.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-print-notifications
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/print-notifications/gsd-print-notifications.target.in 
b/plugins/print-notifications/gsd-print-notifications.target.in
new file mode 100644
index 00000000..87ef1ab9
--- /dev/null
+++ b/plugins/print-notifications/gsd-print-notifications.target.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=GNOME Printer notifications
+
+BindsTo=gsd-print-notifications.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/print-notifications/org.gnome.SettingsDaemon.PrintNotifications.desktop.in 
b/plugins/print-notifications/org.gnome.SettingsDaemon.PrintNotifications.desktop.in
index bbcd6abb..b9c45845 100644
--- a/plugins/print-notifications/org.gnome.SettingsDaemon.PrintNotifications.desktop.in
+++ b/plugins/print-notifications/org.gnome.SettingsDaemon.PrintNotifications.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/rfkill/gsd-rfkill.service.in b/plugins/rfkill/gsd-rfkill.service.in
new file mode 100644
index 00000000..bc654400
--- /dev/null
+++ b/plugins/rfkill/gsd-rfkill.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME RFKill handling
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-rfkill.target
+After=gsd-rfkill.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-rfkill
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/rfkill/gsd-rfkill.target.in b/plugins/rfkill/gsd-rfkill.target.in
new file mode 100644
index 00000000..0608c81f
--- /dev/null
+++ b/plugins/rfkill/gsd-rfkill.target.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=GNOME RFKill handling
+
+BindsTo=gsd-rfkill.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/rfkill/org.gnome.SettingsDaemon.Rfkill.desktop.in 
b/plugins/rfkill/org.gnome.SettingsDaemon.Rfkill.desktop.in
index baa845b6..9c7f27af 100644
--- a/plugins/rfkill/org.gnome.SettingsDaemon.Rfkill.desktop.in
+++ b/plugins/rfkill/org.gnome.SettingsDaemon.Rfkill.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/screensaver-proxy/gsd-screensaver-proxy.service.in 
b/plugins/screensaver-proxy/gsd-screensaver-proxy.service.in
new file mode 100644
index 00000000..723a7658
--- /dev/null
+++ b/plugins/screensaver-proxy/gsd-screensaver-proxy.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Freedesktop screensaver handling
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-screensaver-proxy.target
+After=gsd-screensaver-proxy.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-screensaver-proxy
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/screensaver-proxy/gsd-screensaver-proxy.target.in 
b/plugins/screensaver-proxy/gsd-screensaver-proxy.target.in
new file mode 100644
index 00000000..bc7d387a
--- /dev/null
+++ b/plugins/screensaver-proxy/gsd-screensaver-proxy.target.in
@@ -0,0 +1,15 @@
+[Unit]
+Description=GNOME Freedesktop screensaver handling
+
+BindsTo=gsd-screensaver-proxy.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+Conflicts=gnome-session@gnome-login.target
+Conflicts=gnome-session@gnome-initial-setup.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/screensaver-proxy/org.gnome.SettingsDaemon.ScreensaverProxy.desktop.in 
b/plugins/screensaver-proxy/org.gnome.SettingsDaemon.ScreensaverProxy.desktop.in
index 43822fb4..1130e902 100644
--- a/plugins/screensaver-proxy/org.gnome.SettingsDaemon.ScreensaverProxy.desktop.in
+++ b/plugins/screensaver-proxy/org.gnome.SettingsDaemon.ScreensaverProxy.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/sharing/gsd-sharing.service.in b/plugins/sharing/gsd-sharing.service.in
new file mode 100644
index 00000000..38c5eddf
--- /dev/null
+++ b/plugins/sharing/gsd-sharing.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Sharing handling
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-sharing.target
+After=gsd-sharing.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-sharing
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/sharing/gsd-sharing.target.in b/plugins/sharing/gsd-sharing.target.in
new file mode 100644
index 00000000..cf265ea3
--- /dev/null
+++ b/plugins/sharing/gsd-sharing.target.in
@@ -0,0 +1,15 @@
+[Unit]
+Description=GNOME Sharing handling
+
+BindsTo=gsd-sharing.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+Conflicts=gnome-session@gnome-login.target
+Conflicts=gnome-session@gnome-initial-setup.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/sharing/org.gnome.SettingsDaemon.Sharing.desktop.in 
b/plugins/sharing/org.gnome.SettingsDaemon.Sharing.desktop.in
index 891ba205..d983e785 100644
--- a/plugins/sharing/org.gnome.SettingsDaemon.Sharing.desktop.in
+++ b/plugins/sharing/org.gnome.SettingsDaemon.Sharing.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/smartcard/gsd-smartcard.service.in b/plugins/smartcard/gsd-smartcard.service.in
new file mode 100644
index 00000000..277f3ce1
--- /dev/null
+++ b/plugins/smartcard/gsd-smartcard.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Smartcard handling
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-smartcard.target
+After=gsd-smartcard.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-smartcard
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/smartcard/gsd-smartcard.target.in b/plugins/smartcard/gsd-smartcard.target.in
new file mode 100644
index 00000000..9f5fdae1
--- /dev/null
+++ b/plugins/smartcard/gsd-smartcard.target.in
@@ -0,0 +1,19 @@
+[Unit]
+Description=GNOME Smartcard handling
+
+BindsTo=gsd-smartcard.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+# Start when smartcard hardware is present (requires systemd v234)
+# https://github.com/systemd/systemd/issues/12330
+#Requisite=smartcard.target
+#After=smartcard.target
+#PartOf=smartcard.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
+#WantedBy=smartcard.target
diff --git a/plugins/smartcard/org.gnome.SettingsDaemon.Smartcard.desktop.in 
b/plugins/smartcard/org.gnome.SettingsDaemon.Smartcard.desktop.in
index 71d058c2..fa221850 100644
--- a/plugins/smartcard/org.gnome.SettingsDaemon.Smartcard.desktop.in
+++ b/plugins/smartcard/org.gnome.SettingsDaemon.Smartcard.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/sound/gsd-sound.service.in b/plugins/sound/gsd-sound.service.in
new file mode 100644
index 00000000..5eb5b1bd
--- /dev/null
+++ b/plugins/sound/gsd-sound.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Sound sample caching handling
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-sound.target
+After=gsd-sound.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-sound
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/sound/gsd-sound.target.in b/plugins/sound/gsd-sound.target.in
new file mode 100644
index 00000000..62df05c4
--- /dev/null
+++ b/plugins/sound/gsd-sound.target.in
@@ -0,0 +1,16 @@
+[Unit]
+Description=GNOME Sound sample caching handling
+
+BindsTo=gsd-sound.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+Requires=pulseaudio.service
+After=pulseaudio.service
+# Keep running when pulseaudio.service stops
+
+[Install]
+WantedBy=gnome-session-initialized.target
diff --git a/plugins/sound/org.gnome.SettingsDaemon.Sound.desktop.in 
b/plugins/sound/org.gnome.SettingsDaemon.Sound.desktop.in
index 2048b01b..18339609 100644
--- a/plugins/sound/org.gnome.SettingsDaemon.Sound.desktop.in
+++ b/plugins/sound/org.gnome.SettingsDaemon.Sound.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/wacom/gsd-wacom.service.in b/plugins/wacom/gsd-wacom.service.in
new file mode 100644
index 00000000..131898f3
--- /dev/null
+++ b/plugins/wacom/gsd-wacom.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME Wacom handling
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-wacom.target
+After=gsd-wacom.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-wacom
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/wacom/gsd-wacom.target.in b/plugins/wacom/gsd-wacom.target.in
new file mode 100644
index 00000000..487e895e
--- /dev/null
+++ b/plugins/wacom/gsd-wacom.target.in
@@ -0,0 +1,18 @@
+[Unit]
+Description=GNOME Wacom handling
+
+BindsTo=gsd-wacom.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+# Use the following once wacom.target or similar exists
+#Requisite=wacom.target
+#After=wacom.target
+#PartOf=wacom.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
+#WantedBy=wacom.target
diff --git a/plugins/wacom/org.gnome.SettingsDaemon.Wacom.desktop.in 
b/plugins/wacom/org.gnome.SettingsDaemon.Wacom.desktop.in
index efa5bf00..6086ade2 100644
--- a/plugins/wacom/org.gnome.SettingsDaemon.Wacom.desktop.in
+++ b/plugins/wacom/org.gnome.SettingsDaemon.Wacom.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@
diff --git a/plugins/xsettings/gsd-xsettings.service.in b/plugins/xsettings/gsd-xsettings.service.in
new file mode 100644
index 00000000..a0fd1793
--- /dev/null
+++ b/plugins/xsettings/gsd-xsettings.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=GNOME XSettings
+# Note that we do the shengians with having a target and a service solely
+# so that OnFailure is not called in case of a dependency failure.
+# See also https://github.com/systemd/systemd/issues/12352
+OnFailure=gnome-session-failed.target
+RefuseManualStart=true
+RefuseManualStop=true
+
+PartOf=gsd-xsettings.target
+After=gsd-xsettings.target
+
+[Service]
+Type=dbus
+ExecStart=@libexecdir@/gsd-xsettings
+Restart=on-failure
+BusName=@plugin_dbus_name@
diff --git a/plugins/xsettings/gsd-xsettings.target.in b/plugins/xsettings/gsd-xsettings.target.in
new file mode 100644
index 00000000..f63dd946
--- /dev/null
+++ b/plugins/xsettings/gsd-xsettings.target.in
@@ -0,0 +1,18 @@
+[Unit]
+Description=GNOME XSettings
+
+BindsTo=gsd-xsettings.service
+
+Requisite=gnome-session-initialized.target
+After=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session.target
+
+# Use something similar once appropriate an appropriate target exists for X11
+#Requisite=gnome-session-x11.target
+#After=gnome-session-x11.target
+#PartOf=gnome-session-x11.target
+
+[Install]
+WantedBy=gnome-session-initialized.target
+#WantedBy=gnome-session-x11.target
diff --git a/plugins/xsettings/org.gnome.SettingsDaemon.XSettings.desktop.in 
b/plugins/xsettings/org.gnome.SettingsDaemon.XSettings.desktop.in
index 249fafd7..7e3bfa5c 100644
--- a/plugins/xsettings/org.gnome.SettingsDaemon.XSettings.desktop.in
+++ b/plugins/xsettings/org.gnome.SettingsDaemon.XSettings.desktop.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+@systemd_hidden@



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