Subject: Re: [bug#70282] [PATCH v4] gnu: gnome-shell: Wrap screencast service.

From: Maxim Cournoyer <[email-masked]>
Date: Wed, 08 May 2024 15:51:26 -0400

Hi Dariqq,

Dariqq <[email-masked]> writes:

> Adjust screencast such that GI_TYPELIB_PATH and GST_PLUGIN_SYSTEM_PATH are set
> before starting.
>
> Add all required gstreamer plugins to inputs.
>
> To be able to use it a running pipewire service is needed.
>
> * gnu/packages/gnome.scm (gnome-shell):
> [inputs]: Add gst-plugins-good and pipewire.
> [#:phases]<'wrap-programs>: Wrap org.gnome.Shell.Screencast.

Thanks for your efforts improving our GNOME desktop experience!

> Change-Id: I2c31bf1bd92e281b86c57b06988c6a3793a58d40
> ---
> Here is v4 which appends the gstreamer plugins to
> GST_PLUGIN_SYSTEM_PATH, handling the case when getenv returns null. I
> think the difference between appendending or prepending in this case
> is not too important as the user GST_PLUGIN_PATH should take
> precedent. The more important thing is that the plugins are in any
> plugin path at all.
>
>  gnu/packages/gnome.scm | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index 92e35e3c5a..4bbff2a89b 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -9408,6 +9408,7 @@ (define-public gnome-shell
>              (add-after 'install 'wrap-programs
>                (lambda* (#:key inputs #:allow-other-keys)
>                  (let ((gi-typelib-path  (getenv "GI_TYPELIB_PATH"))
> +                      (gst-plugin-path  (getenv "GST_PLUGIN_SYSTEM_PATH"))
>                        (python-path
>                         (string-join
>                          (filter (lambda (item)
> @@ -9427,6 +9428,19 @@ (define-public gnome-shell
>                                      "path => imports.gi.GIRepository.Repository."
>                                      "prepend_search_path(path));\n"
>                                      all)))
> +                  ;; Screencast requires a pipewire service running
> +                  ;; (i.e. as provided by home-pipewire-service-type)
> +                  (substitute* (string-append #$output "/share/gnome-shell/"
> +                                              "org.gnome.Shell.Screencast")
> +                    (("imports\\.package\\.start" all)
> +                     (string-append "'" gi-typelib-path "'.split(':').forEach("
> +                                    "path => imports.gi.GIRepository.Repository."
> +                                    "prepend_search_path(path));\n"
> +                                    "imports.gi.GLib.setenv('GST_PLUGIN_SYSTEM_PATH',"
> +                                    "[imports.gi.GLib.getenv('GST_PLUGIN_SYSTEM_PATH'),"
> +                                    "'" gst-plugin-path "'].filter(v => v).join(':'),"
> +                                    "true);\n"
> +                                    all)))

Perhaps a simple patch would convey the change better and be easier to
maintain in the future / be readily available for other distributions to
use.

>                    (for-each
>                     (lambda (prog)
>                       (wrap-program (string-append #$output "/bin/" prog)
> @@ -9492,6 +9506,7 @@ (define-public gnome-shell
>             gnome-settings-daemon
>             graphene
>             gst-plugins-base
> +           gst-plugins-good
>             ibus
>             libcanberra
>             libcroco
> @@ -9502,6 +9517,7 @@ (define-public gnome-shell
>             mesa-headers
>             mutter
>             network-manager-applet
> +           pipewire
>             polkit
>             pulseaudio
>             python-pygobject

Otherwise, LGTM!

-- 
Thanks,
Maxim