Subject: [bug#68556] [PATCH gnome-team v4 2/8] gnu: gnome-shell-extensions: Wrap apps-menu.

From: Vivien Kraus <[email-masked]>
Date: Fri, 19 Jan 2024 23:36:05 +0100

* gnu/packages/gnome.scm (gnome-shell-extensions) [#:phases]: Add
'wrap-applications-menu.
[inputs]: Add gobject-introspection and gnome-menus.

Change-Id: I58b79ca92fbceebb9bbb150102fa428022e3eb63
---
 gnu/packages/gnome.scm | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 1e08e027c3..b449ed55db 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -10725,11 +10725,35 @@ (define-public gnome-shell-extensions
                 "1aq1n75m1svsv0ppg66n9qch26rhjxcv3q33a3skf7hsydr5wd4c"))))
     (build-system meson-build-system)
     (arguments
-     '(#:configure-flags '("-Dextension_set=all")))
+     (list
+      #:configure-flags #~'("-Dextension_set=all")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'wrap-applications-menu
+            (lambda _
+              (use-modules (ice-9 textual-ports))
+              (call-with-output-file "extensions/apps-menu/extension.js-wrapped"
+                (lambda (out)
+                  (format out "'~a'.split(':').forEach("
+                          (getenv "GI_TYPELIB_PATH"))
+                  (display
+                   (string-append "path => imports.gi.GIRepository.Repository"
+                                  ".prepend_search_path(path));\n")
+                   out)
+                  (display
+                   (call-with-input-file "extensions/apps-menu/extension.js"
+                     get-string-all)
+                   out)))
+              (rename-file "extensions/apps-menu/extension.js-wrapped"
+                           "extensions/apps-menu/extension.js"))))))
     (native-inputs
      (list `(,glib "bin")
            gettext-minimal
            pkg-config))
+    (inputs
+     (list gobject-introspection ;to set GI_TYPELIB_PATH
+           gnome-menus ;for Applications Menu
+           ))
     (propagated-inputs
      (list glib))
     (synopsis "Extensions for GNOME Shell")
-- 
2.41.0