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

From: Liliana Marie Prikler <[email-masked]>
Date: Wed, 08 May 2024 19:24:26 +0200

Am Sonntag, dem 21.04.2024 um 17:02 +0000 schrieb Dariqq:
> 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.
> 
> Change-Id: I2c31bf1bd92e281b86c57b06988c6a3793a58d40
> ---
> 
> Here is v3 which only uses js to set the environment variables.
> Slight difference to before is that GST_PLUGIN_SYSTEM_PATH gets set
> to specific paths rather than prepending.
> I've also tested if GI_TYPELIB_PATH can be set with GLib.setenv but
> that didn't seem to work,
> so I 've used something similiar as in other places.
> 
>  gnu/packages/gnome.scm | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index 489f23865b..b3c3fb72ad 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -9392,6 +9392,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)
> @@ -9411,6 +9412,18 @@ (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',"
> +                                    "'" gst-plugin-path "'"
> +                                    ", true);\n"
> +                                    all)))
Sorry for the late reply.  You ought to use GLib.getenv to get the
current value, so that you can add the needed paths as a prefix (or
suffix? I'd personally prefer letting the user prefix them).

Cheers