[gnome-shell/benzea/systemd-user-units: 1/2] data: Add systemd units to disable extensions



commit 014392a77a3fe6abbd018b073d8252a3c8d01fbf
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Apr 15 14:45:14 2019 +0200

    data: Add systemd units to disable extensions
    
    when starting using systemd we cannot rely on gnome-session to disable
    extensions for us. So add appropriate units to disable extensions when
    gnome-shell fails and also display a warning message when the user logs
    in the next time.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/507

 data/gnome-shell-disable-extensions.service             | 14 ++++++++++++++
 data/gnome-shell-extensions-disabled-warning.service.in | 13 +++++++++++++
 data/gnome-shell.service.in                             |  1 +
 data/meson.build                                        | 12 ++++++++++--
 4 files changed, 38 insertions(+), 2 deletions(-)
---
diff --git a/data/gnome-shell-disable-extensions.service b/data/gnome-shell-disable-extensions.service
new file mode 100644
index 000000000..552f79f56
--- /dev/null
+++ b/data/gnome-shell-disable-extensions.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Disable GNOME Shell extensions after failure
+
+# Do not require gnome-session-failed.target as that would conflict a possible shutdown
+Wants=gnome-session-failed.target
+
+[Service]
+Type=simple
+# Disable extensions and touch a file; if disabling fails for whatever
+# reason then the file will not be touched.
+ExecStartPre=gsettings set org.gnome.shell disable-user-extensions true
+ExecStart=/bin/touch %E/gnome-shell-extensions-disabled-warning
+Restart=no
+
diff --git a/data/gnome-shell-extensions-disabled-warning.service.in 
b/data/gnome-shell-extensions-disabled-warning.service.in
new file mode 100644
index 000000000..041bc086d
--- /dev/null
+++ b/data/gnome-shell-extensions-disabled-warning.service.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=Warn about GNOME Shell extensions being disabled
+ConditionPathExists=%E/gnome-shell-extensions-disabled-warning
+
+Requisite=gnome-session.target
+After=gnome-session.target
+
+[Service]
+Type=simple
+ExecStartPre=-/bin/rm %E/gnome-shell-extensions-disabled-warning
+ExecStart=@bindir@/gnome-shell-extension-prefs --disabled-warning
+Restart=no
+
diff --git a/data/gnome-shell.service.in b/data/gnome-shell.service.in
index 4e141a70d..0d0ba2758 100644
--- a/data/gnome-shell.service.in
+++ b/data/gnome-shell.service.in
@@ -1,5 +1,6 @@
 [Unit]
 Description=GNOME Shell
+OnFailure=gnome-shell-disable-extensions.service
 RefuseManualStart=true
 
 Requisite=gnome-session-manager.target
diff --git a/data/meson.build b/data/meson.build
index 96beca222..2cc71be4a 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -100,14 +100,22 @@ if have_systemd
   unitconf = configuration_data()
   unitconf.set('bindir', bindir)
 
-  unit = configure_file(
+  configure_file(
     input: 'gnome-shell.service.in',
     output: 'gnome-shell.service',
     configuration: unitconf,
     install_dir: systemd_userunitdir
   )
 
-  units = files('gnome-shell.target')
+  configure_file(
+    input: 'gnome-shell-extensions-disabled-warning.service.in',
+    output: 'gnome-shell-extensions-disabled-warning.service',
+    configuration: unitconf,
+    install_dir: systemd_userunitdir
+  )
+
+  units = files('gnome-shell.target',
+                'gnome-shell-disable-extensions.service')
 
   install_data(units, install_dir: systemd_userunitdir)
 endif


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