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



commit 2ac30482e6018b73b4b5c0bad50f6b24f5672409
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.

 data/gnome-shell-disable-extensions.service             | 11 +++++++++++
 data/gnome-shell-extensions-disabled-warning.service.in | 10 ++++++++++
 data/gnome-shell.service.in                             |  1 +
 data/meson.build                                        | 12 ++++++++++--
 4 files changed, 32 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..aa87fd86f
--- /dev/null
+++ b/data/gnome-shell-disable-extensions.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Disable GNOME Shell extenions after failure
+
+[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..cee8692c5
--- /dev/null
+++ b/data/gnome-shell-extensions-disabled-warning.service.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=Warn about GNOME Shell extenions being disabled
+ConditionPathExists=%E/gnome-shell-extensions-disabled-warning
+
+[Service]
+Type=simple
+ExecStart=@bindir@/gnome-shell-extension-prefs --disabled-warning
+ExecStartPre=/bin/rm %E/gnome-shell-extensions-disabled-warning
+Restart=no
+
diff --git a/data/gnome-shell.service.in b/data/gnome-shell.service.in
index ee275fa0e..6a0f57231 100644
--- a/data/gnome-shell.service.in
+++ b/data/gnome-shell.service.in
@@ -3,6 +3,7 @@ Description=GNOME Shell
 Wants=gnome-session.service
 After=graphical-session-pre.target gnome-session-bus.target
 PartOf=graphical-session.target
+OnFailure=gnome-shell-disable-extensions.service
 
 [Service]
 Type=dbus
diff --git a/data/meson.build b/data/meson.build
index 31ac4514e..55ef9ec7f 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -98,15 +98,23 @@ 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: systemduserunitdir
   )
 
+  configure_file(
+    input: 'gnome-shell-extensions-disabled-warning.service.in',
+    output: 'gnome-shell-extensions-disabled-warning.service',
+    configuration: unitconf,
+    install_dir: systemduserunitdir
+  )
+
   units = files('gnome-shell-wayland.target',
-                'gnome-shell-x11.target')
+                'gnome-shell-x11.target',
+                'gnome-shell-disable-extensions.service')
 
   install_data(units, install_dir: systemduserunitdir)
 endif


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