[PATCH 0/2] Fix gnome-shell screenrecorder

  • Done
  • quality assurance status badge
Details
3 participants
  • Dariqq
  • Liliana Marie Prikler
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Dariqq
Severity
normal
D
D
Dariqq wrote on 8 Apr 17:39 +0200
(address . guix-patches@gnu.org)
cover.1712590252.git.dariqq@posteo.net
Hello Guix,

Last week a user in the irc chat remarked that the built in Gnome screenrecorder is not available which rekado and me then investigated afterwards.

This functionality is provided by the org.gnome.Shell.Screencast dbus service which currently fails to start (if for example you try to investigate it with d-spy you get the not really helpful error: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.gnome.Shell.Screencast exited with status 1)

We later figured that this error happens because the required typelib files cannot be found.

As a fix I imported a patch from NixOS [1] from their gnome-shell 42/44 package and wrapped the relevant files with GI_TYPELIB_PATH. This seems to be strictly necessary only for the screencast service however I wrapped all of the dbus services listed in the js/dbusServices/meson.build file, same as what is done in NixOS.

In order for Screencast to work you'll also need pipewire available (I think for the gstreamer plug-in) which is why I added it to gnome-essential-extras in the second patch.

You'll also need pipewire running (i.e the home-service) which makes this a bit unintuitive for users.
I don't think it is currently possible to enable user level shepherd services from the system configuration, but correct me if I am wrong. Without pipewire running the screen recording stops immediately.

As usual i am not sure if the formating/wording of my commit messages and the name I gave the patch are fine.

Also thanks to rekado for helping to make sense of this.


Dariqq (2):
gnu: gnome-shell: Wrap d-bus services.
gnu: gnome-essential-extras: Propagate pipewire.

gnu/local.mk | 1 +
gnu/packages/gnome.scm | 14 ++++-
.../gnome-shell-wrappable-dbus-services.patch | 59 +++++++++++++++++++
3 files changed, 72 insertions(+), 2 deletions(-)
create mode 100644 gnu/packages/patches/gnome-shell-wrappable-dbus-services.patch


base-commit: cd45294d576975a3bff2f755764a3f46f09ea6f9
--
2.41.0
D
D
Dariqq wrote on 8 Apr 17:53 +0200
[PATCH 1/2] gnu: gnome-shell: Wrap d-bus services.
(address . 70282@debbugs.gnu.org)
fbadd59837f7c90c8040a8abc91e7da7b09b712a.1712590252.git.dariqq@posteo.net
Some of the dbus services can't find typelibs.

* gnu/packages/patches/gnome-shell-wrappable-dbus-services.patch: New file
* gnu/lokal.mk: Register it.
* gnu/packages/gnome.scm (gnome-shell)[arguments]<#:phases>{'wrap}: Also wrap dbus-services.

Change-Id: I2c31bf1bd92e281b86c57b06988c6a3793a58d40
---
gnu/local.mk | 1 +
gnu/packages/gnome.scm | 13 +++-
.../gnome-shell-wrappable-dbus-services.patch | 59 +++++++++++++++++++
3 files changed, 71 insertions(+), 2 deletions(-)
create mode 100644 gnu/packages/patches/gnome-shell-wrappable-dbus-services.patch

Toggle diff (110 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 255bb870e9..21826c9ec7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1376,6 +1376,7 @@ dist_patch_DATA = \
%D%/packages/patches/gnome-online-miners-tracker-3.patch \
%D%/packages/patches/gnome-settings-daemon-gc.patch \
%D%/packages/patches/gnome-session-support-elogind.patch \
+ %D%/packages/patches/gnome-shell-wrappable-dbus-services.patch\
%D%/packages/patches/gnome-tweaks-search-paths.patch \
%D%/packages/patches/gnumach-support-noide.patch \
%D%/packages/patches/gnupg-default-pinentry.patch \
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4934ade3dd..e752232f78 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -9311,7 +9311,9 @@ (define-public gnome-shell
name "-" version ".tar.xz"))
(sha256
(base32
- "01pw9qnnvh64x56z1gqh0qk6vfn0ihh4zijq23f4bpz9wszlbpwf"))))
+ "01pw9qnnvh64x56z1gqh0qk6vfn0ihh4zijq23f4bpz9wszlbpwf"))
+ (patches
+ (search-patches "gnome-shell-wrappable-dbus-services.patch"))))
(build-system meson-build-system)
(arguments
(let ((disallowed-references
@@ -9405,7 +9407,14 @@ (define-public gnome-shell
(wrap-program (string-append #$output "/bin/" prog)
`("GUIX_PYTHONPATH" ":" prefix (,python-path))
`("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))))
- '("gnome-shell-perf-tool")))))
+ '("gnome-shell-perf-tool"))
+ ;; Make sure the dbus services can find typelibs
+ (for-each
+ (lambda (service)
+ (wrap-program (string-append #$output "/share/gnome-shell/" service)
+ `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))))
+ '("org.gnome.ScreenSaver" "org.gnome.Shell.Extensions"
+ "org.gnome.Shell.Notifications" "org.gnome.Shell.Screencast")))))
(add-after 'install 'rewire
(lambda* (#:key inputs #:allow-other-keys)
(for-each
diff --git a/gnu/packages/patches/gnome-shell-wrappable-dbus-services.patch b/gnu/packages/patches/gnome-shell-wrappable-dbus-services.patch
new file mode 100644
index 0000000000..67ed6beadb
--- /dev/null
+++ b/gnu/packages/patches/gnome-shell-wrappable-dbus-services.patch
@@ -0,0 +1,59 @@
+Retrieved from NixOS: https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/desktops/gnome/core/gnome-shell/wrap-services.patch
+---
+diff --git a/js/dbusServices/dbus-service.in b/js/dbusServices/dbus-service.in
+old mode 100644
+new mode 100755
+index 524166102..6d0722a1c
+--- a/js/dbusServices/dbus-service.in
++++ b/js/dbusServices/dbus-service.in
+@@ -1,3 +1,9 @@
++#!@gjs@
++
++// gjs determines the package name from argv[0], which is .*-wrapped
++// so we need to override it to the original one.
++imports.package._findEffectiveEntryPointName = () => '@service@'
++
+ imports.package.start({
+ name: '@PACKAGE_NAME@',
+ prefix: '@prefix@',
+diff --git a/js/dbusServices/dbus-service.service.in b/js/dbusServices/dbus-service.service.in
+index 3b0d09abe..4fd4bb66d 100644
+--- a/js/dbusServices/dbus-service.service.in
++++ b/js/dbusServices/dbus-service.service.in
+@@ -1,3 +1,3 @@
+ [D-BUS Service]
+ Name=@service@
+-Exec=@gjs@ @pkgdatadir@/@service@
++Exec=@pkgdatadir@/@service@
+diff --git a/js/dbusServices/meson.build b/js/dbusServices/meson.build
+index eb941ed90..552051e5a 100644
+--- a/js/dbusServices/meson.build
++++ b/js/dbusServices/meson.build
+@@ -2,6 +2,7 @@ launcherconf = configuration_data()
+ launcherconf.set('PACKAGE_NAME', meson.project_name())
+ launcherconf.set('prefix', prefix)
+ launcherconf.set('libdir', libdir)
++launcherconf.set('gjs', gjs.full_path())
+
+ dbus_services = {
+ 'org.gnome.Shell.Extensions': 'extensions',
+@@ -18,16 +19,17 @@ endif
+ config_dir = '@0@/..'.format(meson.current_build_dir())
+
+ foreach service, dir : dbus_services
++ svc_launcherconf = launcherconf
++ svc_launcherconf.set('service', service)
+ configure_file(
+ input: 'dbus-service.in',
+ output: service,
+- configuration: launcherconf,
++ configuration: svc_launcherconf,
+ install_dir: pkgdatadir,
+ )
+
+ serviceconf = configuration_data()
+ serviceconf.set('service', service)
+- serviceconf.set('gjs', gjs.full_path())
+ serviceconf.set('pkgdatadir', pkgdatadir)
+
+ configure_file(
--
2.41.0
D
D
Dariqq wrote on 8 Apr 17:53 +0200
[PATCH 2/2] gnu: gnome-essential-extras: Propagate pipewire.
(address . 70282@debbugs.gnu.org)
7fd6b30ef26c33ae6e83c930b202124f723b21fc.1712590252.git.dariqq@posteo.net
The built-in gnome-shell screencast requries pipewire.

* gnu/packages/gnome.scm (gnome-essential-extras): Add pipewire.

Change-Id: I6ca5d309f1e6a5f3396b35cfda6d2d470d5b62be
---
gnu/packages/gnome.scm | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index e752232f78..f6e3c2f03b 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -10329,6 +10329,7 @@ (define-public gnome-essential-extras
gst-plugins-good
gucharmap
hicolor-icon-theme
+ pipewire
pinentry-gnome3
pulseaudio
shared-mime-info
--
2.41.0
L
L
Liliana Marie Prikler wrote on 8 Apr 18:49 +0200
2f609eb58628aa60fdf2fa181852250ef35e9ee5.camel@gmail.com
Am Montag, dem 08.04.2024 um 15:53 +0000 schrieb Dariqq:
Toggle quote (21 lines)
> The built-in gnome-shell screencast requries pipewire.
>
> * gnu/packages/gnome.scm (gnome-essential-extras): Add pipewire.
>
> Change-Id: I6ca5d309f1e6a5f3396b35cfda6d2d470d5b62be
> ---
>  gnu/packages/gnome.scm | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index e752232f78..f6e3c2f03b 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -10329,6 +10329,7 @@ (define-public gnome-essential-extras
>                              gst-plugins-good
>                              gucharmap
>                              hicolor-icon-theme
> +                            pipewire
>                              pinentry-gnome3
>                              pulseaudio
>                              shared-mime-info
Should pipewire not go into gnome-shell or something else? Propagating
it here seems weird.
L
L
Liliana Marie Prikler wrote on 8 Apr 18:54 +0200
Re: [bug#70282] [PATCH 1/2] gnu: gnome-shell: Wrap d-bus services.
76b3569290ac70f823228916f8f102c1c5c94d7b.camel@gmail.com
Am Montag, dem 08.04.2024 um 15:53 +0000 schrieb Dariqq:
Toggle quote (7 lines)
> Some of the dbus services can't find typelibs.
>
> * gnu/packages/patches/gnome-shell-wrappable-dbus-services.patch: New
> file
> * gnu/lokal.mk: Register it.
> * gnu/packages/gnome.scm (gnome-shell)[arguments]<#:phases>{'wrap}:
> Also wrap dbus-services.
You can skip [arguments] and just write [#:phases].

Toggle quote (62 lines)
>
> Change-Id: I2c31bf1bd92e281b86c57b06988c6a3793a58d40
> ---
>  gnu/local.mk                                  |  1 +
>  gnu/packages/gnome.scm                        | 13 +++-
>  .../gnome-shell-wrappable-dbus-services.patch | 59
> +++++++++++++++++++
>  3 files changed, 71 insertions(+), 2 deletions(-)
>  create mode 100644 gnu/packages/patches/gnome-shell-wrappable-dbus-
> services.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 255bb870e9..21826c9ec7 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1376,6 +1376,7 @@ dist_patch_DATA
> =                                         \
>    %D%/packages/patches/gnome-online-miners-tracker-3.patch     \
>    %D%/packages/patches/gnome-settings-daemon-gc.patch          \
>    %D%/packages/patches/gnome-session-support-elogind.patch     \
> +  %D%/packages/patches/gnome-shell-wrappable-dbus-services.patch\
>    %D%/packages/patches/gnome-tweaks-search-paths.patch         \
>    %D%/packages/patches/gnumach-support-noide.patch             \
>    %D%/packages/patches/gnupg-default-pinentry.patch            \
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index 4934ade3dd..e752232f78 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -9311,7 +9311,9 @@ (define-public gnome-shell
>                                    name "-" version ".tar.xz"))
>                (sha256
>                 (base32
> -               
> "01pw9qnnvh64x56z1gqh0qk6vfn0ihh4zijq23f4bpz9wszlbpwf"))))
> +               
> "01pw9qnnvh64x56z1gqh0qk6vfn0ihh4zijq23f4bpz9wszlbpwf"))
> +              (patches
> +               (search-patches "gnome-shell-wrappable-dbus-
> services.patch"))))
>      (build-system meson-build-system)
>      (arguments
>       (let ((disallowed-references
> @@ -9405,7 +9407,14 @@ (define-public gnome-shell
>                       (wrap-program (string-append #$output "/bin/"
> prog)
>                         `("GUIX_PYTHONPATH"      ":" prefix (,python-
> path))
>                         `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-
> path))))
> -                   '("gnome-shell-perf-tool")))))
> +                   '("gnome-shell-perf-tool"))
> +                  ;; Make sure the dbus services can find typelibs
> +                  (for-each
> +                   (lambda (service)
> +                     (wrap-program (string-append #$output
> "/share/gnome-shell/" service)
> +                       `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-
> path))))
> +                   '("org.gnome.ScreenSaver"
> "org.gnome.Shell.Extensions"
> +                     "org.gnome.Shell.Notifications"
> "org.gnome.Shell.Screencast")))))
LGTM
Toggle quote (29 lines)
>              (add-after 'install 'rewire
>                (lambda* (#:key inputs #:allow-other-keys)
>                  (for-each
> diff --git a/gnu/packages/patches/gnome-shell-wrappable-dbus-
> services.patch b/gnu/packages/patches/gnome-shell-wrappable-dbus-
> services.patch
> new file mode 100644
> index 0000000000..67ed6beadb
> --- /dev/null
> +++ b/gnu/packages/patches/gnome-shell-wrappable-dbus-services.patch
> @@ -0,0 +1,59 @@
> +Retrieved from NixOS:
> https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/desktops/gnome/core/gnome-shell/wrap-services.patch
> +---
> +diff --git a/js/dbusServices/dbus-service.in b/js/dbusServices/dbus-
> service.in
> +old mode 100644
> +new mode 100755
> +index 524166102..6d0722a1c
> +--- a/js/dbusServices/dbus-service.in
> ++++ b/js/dbusServices/dbus-service.in
> +@@ -1,3 +1,9 @@
> ++#!@gjs@
> ++
> ++// gjs determines the package name from argv[0], which is .*-
> wrapped
> ++// so we need to override it to the original one.
> ++imports.package._findEffectiveEntryPointName = () => '@service@'
> ++
Is there no other way to specify the entry point?
Toggle quote (46 lines)
> + imports.package.start({
> +     name: '@PACKAGE_NAME@',
> +     prefix: '@prefix@',
> +diff --git a/js/dbusServices/dbus-service.service.in
> b/js/dbusServices/dbus-service.service.in
> +index 3b0d09abe..4fd4bb66d 100644
> +--- a/js/dbusServices/dbus-service.service.in
> ++++ b/js/dbusServices/dbus-service.service.in
> +@@ -1,3 +1,3 @@
> + [D-BUS Service]
> + Name=@service@
> +-Exec=@gjs@ @pkgdatadir@/@service@
> ++Exec=@pkgdatadir@/@service@
> +diff --git a/js/dbusServices/meson.build
> b/js/dbusServices/meson.build
> +index eb941ed90..552051e5a 100644
> +--- a/js/dbusServices/meson.build
> ++++ b/js/dbusServices/meson.build
> +@@ -2,6 +2,7 @@ launcherconf = configuration_data()
> + launcherconf.set('PACKAGE_NAME', meson.project_name())
> + launcherconf.set('prefix', prefix)
> + launcherconf.set('libdir', libdir)
> ++launcherconf.set('gjs', gjs.full_path())
> +
> + dbus_services = {
> +   'org.gnome.Shell.Extensions': 'extensions',
> +@@ -18,16 +19,17 @@ endif
> + config_dir = '@0@/..'.format(meson.current_build_dir())
> +
> + foreach service, dir : dbus_services
> ++  svc_launcherconf = launcherconf
> ++  svc_launcherconf.set('service', service)
> +   configure_file(
> +     input: 'dbus-service.in',
> +     output: service,
> +-    configuration: launcherconf,
> ++    configuration: svc_launcherconf,
> +     install_dir: pkgdatadir,
> +   )
> +
> +   serviceconf = configuration_data()
> +   serviceconf.set('service', service)
> +-  serviceconf.set('gjs', gjs.full_path())
> +   serviceconf.set('pkgdatadir', pkgdatadir)
> +
> +   configure_file(
Cheers
D
D
Dariqq wrote on 9 Apr 16:05 +0200
Re: [bug#70282] [PATCH 2/2] gnu: gnome-essential-extras: Propagate pipewire.
a3d11265-f2e1-4e52-be0a-daeec048cb19@posteo.net
On 08.04.24 18:49, Liliana Marie Prikler wrote:
Toggle quote (25 lines)
> Am Montag, dem 08.04.2024 um 15:53 +0000 schrieb Dariqq:
>> The built-in gnome-shell screencast requries pipewire.
>>
>> * gnu/packages/gnome.scm (gnome-essential-extras): Add pipewire.
>>
>> Change-Id: I6ca5d309f1e6a5f3396b35cfda6d2d470d5b62be
>> ---
>>  gnu/packages/gnome.scm | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
>> index e752232f78..f6e3c2f03b 100644
>> --- a/gnu/packages/gnome.scm
>> +++ b/gnu/packages/gnome.scm
>> @@ -10329,6 +10329,7 @@ (define-public gnome-essential-extras
>>                              gst-plugins-good
>>                              gucharmap
>>                              hicolor-icon-theme
>> +                            pipewire
>>                              pinentry-gnome3
>>                              pulseaudio
>>                              shared-mime-info
> Should pipewire not go into gnome-shell or something else? Propagating
> it here seems weird.

I wasn't sure if only the gstreamer plugin of pipewire are required or
something else from the pipewire package too and that was the easy solution.

I just tested adding pipewire to gnome-shell and adding
GST_PLUGIN_SYSTEM_PATH to the wrapper seems to be enough.

While working on this I also found that also gst-plugins-good are also
required for the Screencast service which will get found using the
system profile as it is propagated by gnome-essential-extras. Should
that also be added to gnome-shell?
D
D
Dariqq wrote on 9 Apr 17:35 +0200
Re: [bug#70282] [PATCH 1/2] gnu: gnome-shell: Wrap d-bus services.
0704fbb9-91f7-4868-9d45-8236be7a84d6@posteo.net
Hi,


On 08.04.24 18:54, Liliana Marie Prikler wrote:

Toggle quote (6 lines)
>> new file mode 100644 index 0000000000..67ed6beadb --- /dev/null +++
>> b/gnu/packages/patches/gnome-shell-wrappable-dbus-services.patch @@
>> -0,0 +1,59 @@ +Retrieved from NixOS:
>> https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/desktops/gnome/core/gnome-shell/wrap-services.patch
>>
>>
+---
Toggle quote (11 lines)
>> +diff --git a/js/dbusServices/dbus-service.in
>> b/js/dbusServices/dbus- service.in +old mode 100644 +new mode
>> 100755 +index 524166102..6d0722a1c +---
>> a/js/dbusServices/dbus-service.in ++++
>> b/js/dbusServices/dbus-service.in +@@ -1,3 +1,9 @@ ++#!@gjs@ ++
>> ++// gjs determines the package name from argv[0], which is .*-
>> wrapped ++// so we need to override it to the original one.
>> ++imports.package._findEffectiveEntryPointName = () => '@service@'
>> ++
> Is there no other way to specify the entry point?

If it is just about the name in argv[0] what about creating a *-wrapper
instead and leaving the original file untouched rather than the wrapper
replacing the original file?

One quick way would be to rename the wrapper script and original file
after wrap-program is called, fix the path in the wrapper script and
adjust the dbus service file to call the *-wrapper instead.

Have a nice day.
L
L
Liliana Marie Prikler wrote on 9 Apr 19:04 +0200
fe81e6510dec018ecc877d832fb7cf86cbcc7d1b.camel@gmail.com
Am Dienstag, dem 09.04.2024 um 15:35 +0000 schrieb Dariqq:
Toggle quote (35 lines)
> Hi,
>
>
> On 08.04.24 18:54, Liliana Marie Prikler wrote:
>
> > > new file mode 100644 index 0000000000..67ed6beadb --- /dev/null
> > > +++
> > > b/gnu/packages/patches/gnome-shell-wrappable-dbus-services.patch
> > > @@
> > > -0,0 +1,59 @@ +Retrieved from NixOS:
> > > https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/desktops/gnome/core/gnome-shell/wrap-services.patch
> > >
> > >
> +---
> > > +diff --git a/js/dbusServices/dbus-service.in
> > > b/js/dbusServices/dbus- service.in +old mode 100644 +new mode
> > > 100755 +index 524166102..6d0722a1c +---
> > > a/js/dbusServices/dbus-service.in ++++
> > > b/js/dbusServices/dbus-service.in +@@ -1,3 +1,9 @@ ++#!@gjs@ ++
> > > ++// gjs determines the package name from argv[0], which is .*-
> > > wrapped ++// so we need to override it to the original one.
> > > ++imports.package._findEffectiveEntryPointName = () =>
> > > '@service@'
> > > ++
> > Is there no other way to specify the entry point?
>
> If it is just about the name in argv[0] what about creating a *-
> wrapper instead and leaving the original file untouched rather than
> the wrapper replacing the original file?
>
> One quick way would be to rename the wrapper script and original file
> after wrap-program is called, fix the path in the wrapper script and
> adjust the dbus service file to call the *-wrapper instead.
>
> Have a nice day.
You can possibly use wrap-script instead of wrap-program, so that you
only need a single file. I've also written Javascript code to expand
GI_TYPELIB_PATH in other packages already, perhaps you want to copy
that?

Cheers
D
D
Dariqq wrote on 10 Apr 10:07 +0200
0004900a-2846-4f02-9c76-bf01ab21e11e@posteo.net
On 09.04.24 19:04, Liliana Marie Prikler wrote:
Toggle quote (7 lines)
> You can possibly use wrap-script instead of wrap-program, so that you
> only need a single file. I've also written Javascript code to expand
> GI_TYPELIB_PATH in other packages already, perhaps you want to copy
> that?
>
> Cheers

Thanks for the hint with the javascript code. This makes the fix even
easier as the extra patch is no longer required.

But then what to do with pipewire/GST_PLUGIN_SYSTEM_PATH? We would be
back at propagating it somewhere.

Also do you have an idea how to communicate to users to enable the
pipewire home service if they want the screenrecorder to work?

Have a nice day.
L
L
Liliana Marie Prikler wrote on 10 Apr 20:20 +0200
b7a9eab6da2707b5fc7fd4ea7be2ef34ecfbafd1.camel@gmail.com
Am Mittwoch, dem 10.04.2024 um 08:07 +0000 schrieb Dariqq:
Toggle quote (18 lines)
>
>
> On 09.04.24 19:04, Liliana Marie Prikler wrote:
> > You can possibly use wrap-script instead of wrap-program, so that
> > you only need a single file.  I've also written Javascript code to
> > expand GI_TYPELIB_PATH in other packages already, perhaps you want
> > to copy that?
> >
> > Cheers
>
> Thanks for the hint with the javascript code. This makes the fix even
> easier as the extra patch is no longer required.
>
> But then what to do with pipewire/GST_PLUGIN_SYSTEM_PATH? We would be
> back at propagating it somewhere.
>
> Also do you have an idea how to communicate to users to enable the
> pipewire home service if they want the screenrecorder to work?
For pipewire I'm not sure what the problem is, really. For
GST_PLUGIN_SYSTEM_PATH you can add a wrapper that amends the
environment variable or possibly call some Gst function – either in
Guile with wrap-script or possibly in Javascript.

Cheers
D
D
Dariqq wrote on 11 Apr 11:04 +0200
fcb6250d-20ca-4ae8-b588-c22269968512@posteo.net
Hi,

On 10.04.24 20:20, Liliana Marie Prikler wrote:
Toggle quote (26 lines)
> Am Mittwoch, dem 10.04.2024 um 08:07 +0000 schrieb Dariqq:
>>
>>
>> On 09.04.24 19:04, Liliana Marie Prikler wrote:
>>> You can possibly use wrap-script instead of wrap-program, so that
>>> you only need a single file.  I've also written Javascript code to
>>> expand GI_TYPELIB_PATH in other packages already, perhaps you want
>>> to copy that?
>>>
>>> Cheers
>>
>> Thanks for the hint with the javascript code. This makes the fix even
>> easier as the extra patch is no longer required.
>>
>> But then what to do with pipewire/GST_PLUGIN_SYSTEM_PATH? We would be
>> back at propagating it somewhere.
>>
>> Also do you have an idea how to communicate to users to enable the
>> pipewire home service if they want the screenrecorder to work?


> For pipewire I'm not sure what the problem is, really. For
> GST_PLUGIN_SYSTEM_PATH you can add a wrapper that amends the
> environment variable or possibly call some Gst function – either in
> Guile with wrap-script or possibly in Javascript.

Unfortunately wrap-script does not work as the file
#$gnome-shell/share/gnome-shell/org.gnome.Shell.Screencast has no
shebang line set and even if it would ( enabled by the extra patch) gjs
is not a valid interpreter for wrap_script and trying to change that
rebuilds everything.


I am currently trying to find out if it is possible to do a similiar
thing as the GI_TYPELIB_PATH with javascript. Or change the environment
variable before through another way. My limited javascript knowledge is
not helping here either.

Toggle quote (2 lines)
> Cheers

Have a nice day
D
D
Dariqq wrote on 12 Apr 19:26 +0200
[PATCH v2] gnu: gnome-shell: Wrap screencast service.
(address . 70282@debbugs.gnu.org)(name . Dariqq)(address . dariqq@posteo.net)
d5f358b4d17606032eba8a49ff7980720e7d4b4d.1712942808.git.dariqq@posteo.net
The screencast service can now find typelibs and gstreamer plugins.

* gnu/packages/linux.scm (gnome-shell)
[inputs]: Add gst-plugins-good and pipewire.
[#:phases]<'wrap-programs>: Create a wrapper for screencast service and use it.

Change-Id: I2c31bf1bd92e281b86c57b06988c6a3793a58d40
---

Hi,

Here is v2 of the patch. The wrapper is now created manually as I was unable to find a way to manipulate the gstreamer plugin load path from within javascript. Importantly this leaves the original javascript file untouched and therefore circumvents the argv[0] problem in v1.
All the required gstreamer plugins (pipewire and gst-plugins-good) are now inputs and are in the wrapper via GST_PLUGIN_SYSTEM_PATH.

I've also left a comment for the required home-pipewire-service.
In gnome-shell 45+ the invocation has changed to 'gjs -m service'. Should this also be a comment somewhere?


gnu/packages/gnome.scm | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)

Toggle diff (73 lines)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 4934ade3dd..d68624344f 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -9381,6 +9381,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)
@@ -9405,7 +9406,39 @@ (define-public gnome-shell
(wrap-program (string-append #$output "/bin/" prog)
`("GUIX_PYTHONPATH" ":" prefix (,python-path))
`("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))))
- '("gnome-shell-perf-tool")))))
+ '("gnome-shell-perf-tool"))
+ ;; Make a wrapper for the screencast service
+ ;; Requires a pipewire service running
+ ;; (i.e. as provided by home-pipewire-service-type)
+ (let* ((screencast "org.gnome.Shell.Screencast")
+ (dir (string-append #$output "/share/gnome-shell/"))
+ (dbus-service-dir (string-append #$output
+ "/share/dbus-1/"
+ "services/"))
+ (wrapper (string-append dir screencast "-wrapper")))
+ (call-with-output-file wrapper
+ (lambda (port)
+ (format port
+ (string-append
+ "#!~a~%"
+ "export GI_TYPELIB_PATH=~a~%"
+ "export GST_PLUGIN_SYSTEM_PATH=~a~%"
+ "exec \"~a\" \"~a\" \"$@\"~%")
+ (which "bash")
+ (format #f "\"~a${~a:+:}$~a\""
+ gi-typelib-path
+ "GI_TYPELIB_PATH" "GI_TYPELIB_PATH")
+ (format #f "\"~a${~a:+:}$~a\""
+ gst-plugin-path
+ "GST_PLUGIN_SYSTEM_PATH"
+ "GST_PLUGIN_SYSTEM_PATH")
+ (string-append #$(this-package-input "gjs")
+ "/bin/gjs")
+ (string-append dir screencast))))
+ (chmod wrapper #o555)
+ (substitute* (string-append dbus-service-dir screencast
+ ".service")
+ (("Exec=.*") (string-append "Exec=" wrapper "\n")))))))
(add-after 'install 'rewire
(lambda* (#:key inputs #:allow-other-keys)
(for-each
@@ -9465,6 +9498,7 @@ (define-public gnome-shell
gnome-settings-daemon
graphene
gst-plugins-base
+ gst-plugins-good
ibus
libcanberra
libcroco
@@ -9475,6 +9509,7 @@ (define-public gnome-shell
mesa-headers
mutter
network-manager-applet
+ pipewire
polkit
pulseaudio
python-pygobject

base-commit: 3dc26b4eaed448cbc02a80bafb2ebb6d908f2b4e
--
2.41.0
L
L
Liliana Marie Prikler wrote on 19 Apr 20:51 +0200
0497984af8f383af8e8b981d78dc9baf23869e30.camel@gmail.com
Am Freitag, dem 12.04.2024 um 17:26 +0000 schrieb Dariqq:
Toggle quote (19 lines)
> The screencast service can now find typelibs and gstreamer plugins.
>
> * gnu/packages/linux.scm (gnome-shell)
> [inputs]: Add gst-plugins-good and pipewire.
> [#:phases]<'wrap-programs>: Create a wrapper for screencast service
> and use it.
>
> Change-Id: I2c31bf1bd92e281b86c57b06988c6a3793a58d40
> ---
>
> Hi,
>
> Here is v2 of the patch. The wrapper is now created manually as I was
> unable to find a way to manipulate the gstreamer plugin load path
> from within javascript. Importantly this leaves the original
> javascript file untouched and therefore circumvents the argv[0]
> problem in v1.
> All the required gstreamer plugins (pipewire and gst-plugins-good)
> are now inputs and are in the wrapper via GST_PLUGIN_SYSTEM_PATH.
I'm not sure this fix is sounds. It looks like it misses manual
invocation from the command line, does it not? (Well, it's gnome-
shell, so if you have to invoke it from the command line, things are
broken, but still…) What keeps you from wrapping the environment
variable in Javascript?

Toggle quote (3 lines)
> I've also left a comment for the required home-pipewire-service.
> In gnome-shell 45+ the invocation has changed to 'gjs -m service'.
> Should this also be a comment somewhere?
Gnome-shell 45+ is currently irrelevant, but we might have to adapt
things once we get there on gnome-team. We do need a better gjs-
patching strategy.

Cheers
D
D
Dariqq wrote on 20 Apr 12:11 +0200
f929f311-7192-411d-a889-f24a134141c9@posteo.net
On 19.04.24 20:51, Liliana Marie Prikler wrote:
Toggle quote (25 lines)
> Am Freitag, dem 12.04.2024 um 17:26 +0000 schrieb Dariqq:
>> The screencast service can now find typelibs and gstreamer plugins.
>>
>> * gnu/packages/linux.scm (gnome-shell)
>> [inputs]: Add gst-plugins-good and pipewire.
>> [#:phases]<'wrap-programs>: Create a wrapper for screencast service
>> and use it.
>>
>> Change-Id: I2c31bf1bd92e281b86c57b06988c6a3793a58d40
>> ---
>>
>> Hi,
>>
>> Here is v2 of the patch. The wrapper is now created manually as I was
>> unable to find a way to manipulate the gstreamer plugin load path
>> from within javascript. Importantly this leaves the original
>> javascript file untouched and therefore circumvents the argv[0]
>> problem in v1.
>> All the required gstreamer plugins (pipewire and gst-plugins-good)
>> are now inputs and are in the wrapper via GST_PLUGIN_SYSTEM_PATH.
> I'm not sure this fix is sounds. It looks like it misses manual
> invocation from the command line, does it not? (Well, it's gnome-
> shell, so if you have to invoke it from the command line, things are
> broken, but still…)

If only the typelib path is set the dbus service now longer greets you
with an error but still fails to start without the gstreamer plugins.
That's why in v1 I was propagating pipewire through gnome-essential-extras.

I am not sure what you mean by manual invocation. The screencast service
should get started via dbus. Nothing manual should be required (other
than enabling the pipewire home service).

What keeps you from wrapping the environment
Toggle quote (2 lines)
> variable in Javascript?

I was unable to find a way to manipulate the GST_PLUGIN_PATH or specify
the gst search path from within javascript. There is
Gst.Registry().scan_path but this creates a new registry and I don't
think is what we want here. (but I don't know anything about gstreamer
and javascript so I could be wrong here).

I guess the most simple patch for the typelibs would be something like


Toggle diff (57 lines)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index fa6c566c75..28c4e540a6 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -9404,13 +9404,15 @@ (define-public gnome-shell
(wrap-program (string-append #$output "/bin/" prog)
`("GI_TYPELIB_PATH" ":" prefix
(,gi-typelib-path))))
'("gnome-shell" "gnome-extensions-app"))
- (substitute* (string-append #$output
"/share/gnome-shell/"
- "org.gnome.Shell.Extensions")
- (("imports\\.package\\.start" all)
- (string-append "'" gi-typelib-path
"'.split(':').forEach("
- "path =>
imports.gi.GIRepository.Repository."
- "prepend_search_path(path));\n"
- all)))
+ (for-each
+ (lambda (prog)
+ (substitute* (string-append #$output
"/share/gnome-shell/" prog)
+ (("imports\\.package\\.start" all)
+ (string-append "'" gi-typelib-path
"'.split(':').forEach("
+ "path =>
imports.gi.GIRepository.Repository."
+ "prepend_search_path(path));\n"
+ all))))
+ '("org.gnome.Shell.Extensions"
"org.gnome.Shell.Screencast"))
(for-each
(lambda (prog)
(wrap-program (string-append #$output "/bin/" prog)


and dealing with the gstreamer plugins in another way.

>> I've also left a comment for the required home-pipewire-service.
>> In gnome-shell 45+ the invocation has changed to 'gjs -m service'.
>> Should this also be a comment somewhere?
> Gnome-shell 45+ is currently irrelevant, but we might have to adapt
> things once we get there on gnome-team. We do need a better gjs-
> patching strategy.
>

It would be nice if something like wrap-script would work. But the
problem is that the dbus services specify somehting like "Exec= gjs
service" rather than executing a gjs-script directly. (which is the main
purpose of the patch from nixos). And also gjs not being a valid
interpreter for wrap-script (Changing that will rebuild everything)

> Cheers
>

Have an nice day.
L
L
Liliana Marie Prikler wrote on 20 Apr 12:46 +0200
7a635b027f59d348312098650d1606f2e658ffab.camel@gmail.com
Am Samstag, dem 20.04.2024 um 10:11 +0000 schrieb Dariqq:
Toggle quote (39 lines)
>
>
> On 19.04.24 20:51, Liliana Marie Prikler wrote:
> > Am Freitag, dem 12.04.2024 um 17:26 +0000 schrieb Dariqq:
> > > The screencast service can now find typelibs and gstreamer
> > > plugins.
> > >
> > > * gnu/packages/linux.scm (gnome-shell)
> > > [inputs]: Add gst-plugins-good and pipewire.
> > > [#:phases]<'wrap-programs>: Create a wrapper for screencast
> > > service
> > > and use it.
> > >
> > > Change-Id: I2c31bf1bd92e281b86c57b06988c6a3793a58d40
> > > ---
> > >
> > > Hi,
> > >
> > > Here is v2 of the patch. The wrapper is now created manually as I
> > > was unable to find a way to manipulate the gstreamer plugin load
> > > path from within javascript. Importantly this leaves the original
> > > javascript file untouched and therefore circumvents the argv[0]
> > > problem in v1.
> > > All the required gstreamer plugins (pipewire and gst-plugins-
> > > good) are now inputs and are in the wrapper via
> > > GST_PLUGIN_SYSTEM_PATH.
> > I'm not sure this fix is sounds.  It looks like it misses manual
> > invocation from the command line, does it not?  (Well, it's gnome-
> > shell, so if you have to invoke it from the command line, things
> > are broken, but still…)
>
> If only the typelib path is set the dbus service now longer greets
> you with an error but still fails to start without the gstreamer
> plugins. That's why in v1 I was propagating pipewire through
> gnome-essential-extras.
>
> I am not sure what you mean by manual invocation. The screencast
> service should get started via dbus. Nothing manual should be
> required (other than enabling the pipewire home service).
Just what it says on the tin, manually running the "binary" through the
command line. It's not super useful with GNOME, but I think we should
make sure our services work whichever way they could be invoked.

Toggle quote (8 lines)
>    What keeps you from wrapping the environment
> > variable in Javascript?
>
> I was unable to find a way to manipulate the GST_PLUGIN_PATH or
> specify the gst search path from within javascript. There is
> Gst.Registry().scan_path but this creates a new registry and I don't
> think is what we want here. (but I don't know anything about
> gstreamer and javascript so I could be wrong here).
Instead of creating a new Gst.Registry – as per the () here – you could
use gst_registry_get() or whatever the according JS method is to access
the Registry singleton.

The Registry constructor ought to be protected, but idk how GJS handles
that.

Toggle quote (46 lines)
> I guess the most simple patch for the typelibs would be something
> like
>
>
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index fa6c566c75..28c4e540a6 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -9404,13 +9404,15 @@ (define-public gnome-shell
>                        (wrap-program (string-append #$output "/bin/"
> prog)
>                          `("GI_TYPELIB_PATH" ":" prefix
> (,gi-typelib-path))))
>                      '("gnome-shell" "gnome-extensions-app"))
> -                  (substitute* (string-append #$output
> "/share/gnome-shell/"
> -                                             
> "org.gnome.Shell.Extensions")
> -                    (("imports\\.package\\.start" all)
> -                     (string-append "'" gi-typelib-path
> "'.split(':').forEach("
> -                                    "path =>
> imports.gi.GIRepository.Repository."
> -                                    "prepend_search_path(path));\n"
> -                                    all)))
> +                  (for-each
> +                   (lambda (prog)
> +                     (substitute* (string-append #$output
> "/share/gnome-shell/" prog)
> +                       (("imports\\.package\\.start" all)
> +                        (string-append "'" gi-typelib-path
> "'.split(':').forEach("
> +                                       "path =>
> imports.gi.GIRepository.Repository."
> +                                      
> "prepend_search_path(path));\n"
> +                                       all))))
> +                   '("org.gnome.Shell.Extensions"
> "org.gnome.Shell.Screencast"))
>                     (for-each
>                      (lambda (prog)
>                        (wrap-program (string-append #$output "/bin/"
> prog)
>
>
> and dealing with the gstreamer plugins in another way.
Hmm, could you add --gst-plugin-path on the command line?

Toggle quote (14 lines)
> > > I've also left a comment for the required home-pipewire-service.
> > > In gnome-shell 45+ the invocation has changed to 'gjs -m
> > > service'.
> > > Should this also be a comment somewhere?
> > Gnome-shell 45+ is currently irrelevant, but we might have to adapt
> > things once we get there on gnome-team.  We do need a better gjs-
> > patching strategy.
> >
>
> It would be nice if something like wrap-script would work. But the
> problem is that the dbus services specify somehting like "Exec= gjs
> service" rather than executing a gjs-script directly. (which is the
> main purpose of the patch from nixos). And also gjs not being a valid
> interpreter for wrap-script (Changing that will rebuild everything)
You can redo the needed logic locally and add a "XXX: Use wrap-script
once it can handle gjs" for example. That's no hard blocker, but it's
not the nicest option either, I admit. Let's try our other options
first.

Toggle quote (1 lines)
>
Cheers
D
D
Dariqq wrote on 21 Apr 14:37 +0200
8e84c417-825a-416a-8ca0-ed5aebda489e@posteo.net
On 20.04.24 12:46, Liliana Marie Prikler wrote:
Toggle quote (60 lines)
> Am Samstag, dem 20.04.2024 um 10:11 +0000 schrieb Dariqq:
>>
>>
>> On 19.04.24 20:51, Liliana Marie Prikler wrote:
>>> Am Freitag, dem 12.04.2024 um 17:26 +0000 schrieb Dariqq:
>>>> The screencast service can now find typelibs and gstreamer
>>>> plugins.
>>>>
>>>> * gnu/packages/linux.scm (gnome-shell)
>>>> [inputs]: Add gst-plugins-good and pipewire.
>>>> [#:phases]<'wrap-programs>: Create a wrapper for screencast
>>>> service
>>>> and use it.
>>>>
>>>> Change-Id: I2c31bf1bd92e281b86c57b06988c6a3793a58d40
>>>> ---
>>>>
>>>> Hi,
>>>>
>>>> Here is v2 of the patch. The wrapper is now created manually as I
>>>> was unable to find a way to manipulate the gstreamer plugin load
>>>> path from within javascript. Importantly this leaves the original
>>>> javascript file untouched and therefore circumvents the argv[0]
>>>> problem in v1.
>>>> All the required gstreamer plugins (pipewire and gst-plugins-
>>>> good) are now inputs and are in the wrapper via
>>>> GST_PLUGIN_SYSTEM_PATH.
>>> I'm not sure this fix is sounds.  It looks like it misses manual
>>> invocation from the command line, does it not?  (Well, it's gnome-
>>> shell, so if you have to invoke it from the command line, things
>>> are broken, but still…)
>>
>> If only the typelib path is set the dbus service now longer greets
>> you with an error but still fails to start without the gstreamer
>> plugins. That's why in v1 I was propagating pipewire through
>> gnome-essential-extras.
>>
>> I am not sure what you mean by manual invocation. The screencast
>> service should get started via dbus. Nothing manual should be
>> required (other than enabling the pipewire home service).
> Just what it says on the tin, manually running the "binary" through the
> command line. It's not super useful with GNOME, but I think we should
> make sure our services work whichever way they could be invoked.
>
>>    What keeps you from wrapping the environment
>>> variable in Javascript?
>>
>> I was unable to find a way to manipulate the GST_PLUGIN_PATH or
>> specify the gst search path from within javascript. There is
>> Gst.Registry().scan_path but this creates a new registry and I don't
>> think is what we want here. (but I don't know anything about
>> gstreamer and javascript so I could be wrong here).
> Instead of creating a new Gst.Registry – as per the () here – you could
> use gst_registry_get() or whatever the according JS method is to access
> the Registry singleton.
>
> The Registry constructor ought to be protected, but idk how GJS handles
> that.
>

I've tried adding Gst.Registry.get().scan_path() after the GI_TYPELIB
expansion but I am not sure why it does not work. Stracing the
invocation shows that the pipewire gstreamer plugin is accessed at the
beginning but it is still not available somehow. Probably because of my
lack of knowledge about gstreamer.

Toggle quote (68 lines)
>> I guess the most simple patch for the typelibs would be something
>> like
>>
>>
>> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
>> index fa6c566c75..28c4e540a6 100644
>> --- a/gnu/packages/gnome.scm
>> +++ b/gnu/packages/gnome.scm
>> @@ -9404,13 +9404,15 @@ (define-public gnome-shell
>>                        (wrap-program (string-append #$output "/bin/"
>> prog)
>>                          `("GI_TYPELIB_PATH" ":" prefix
>> (,gi-typelib-path))))
>>                      '("gnome-shell" "gnome-extensions-app"))
>> -                  (substitute* (string-append #$output
>> "/share/gnome-shell/"
>> -
>> "org.gnome.Shell.Extensions")
>> -                    (("imports\\.package\\.start" all)
>> -                     (string-append "'" gi-typelib-path
>> "'.split(':').forEach("
>> -                                    "path =>
>> imports.gi.GIRepository.Repository."
>> -                                    "prepend_search_path(path));\n"
>> -                                    all)))
>> +                  (for-each
>> +                   (lambda (prog)
>> +                     (substitute* (string-append #$output
>> "/share/gnome-shell/" prog)
>> +                       (("imports\\.package\\.start" all)
>> +                        (string-append "'" gi-typelib-path
>> "'.split(':').forEach("
>> +                                       "path =>
>> imports.gi.GIRepository.Repository."
>> +
>> "prepend_search_path(path));\n"
>> +                                       all))))
>> +                   '("org.gnome.Shell.Extensions"
>> "org.gnome.Shell.Screencast"))
>>                     (for-each
>>                      (lambda (prog)
>>                        (wrap-program (string-append #$output "/bin/"
>> prog)
>>
>>
>> and dealing with the gstreamer plugins in another way.
> Hmm, could you add --gst-plugin-path on the command line?
>
>>>> I've also left a comment for the required home-pipewire-service.
>>>> In gnome-shell 45+ the invocation has changed to 'gjs -m
>>>> service'.
>>>> Should this also be a comment somewhere?
>>> Gnome-shell 45+ is currently irrelevant, but we might have to adapt
>>> things once we get there on gnome-team.  We do need a better gjs-
>>> patching strategy.
>>>
>>
>> It would be nice if something like wrap-script would work. But the
>> problem is that the dbus services specify somehting like "Exec= gjs
>> service" rather than executing a gjs-script directly. (which is the
>> main purpose of the patch from nixos). And also gjs not being a valid
>> interpreter for wrap-script (Changing that will rebuild everything)
> You can redo the needed logic locally and add a "XXX: Use wrap-script
> once it can handle gjs" for example. That's no hard blocker, but it's
> not the nicest option either, I admit. Let's try our other options
> first.
>

I've just found GLib.setenv() to set environment variables for the
process directly from within gjs. The GLib typelib comes from the
gobject-introspection package so this should be available.

From my limited testing it seems to work (at least for the screencast
service). What do you think?

Toggle quote (2 lines)
> Cheers

Have a nice day.
L
L
Liliana Marie Prikler wrote on 21 Apr 14:43 +0200
e6f66b3886040afaab702d8707dc01ff4bc2ce7d.camel@gmail.com
Am Sonntag, dem 21.04.2024 um 12:37 +0000 schrieb Dariqq:
Toggle quote (8 lines)
> >
> [...]
> I've just found GLib.setenv() to set environment variables for the
> process directly from within gjs. The GLib typelib comes from the
> gobject-introspection package so this should be available.
>
> From my limited testing it seems to work (at least for the screencast
> service). What do you think?
Yes, GLib.setenv is the function I had in mind to twiddle the
environment. If you find the right location to do so at the start of
the program, please send a patch that does that.

Cheers
D
D
Dariqq wrote on 21 Apr 19:02 +0200
[PATCH v3] gnu: gnome-shell: Wrap screencast service.
(address . 70282@debbugs.gnu.org)(name . Dariqq)(address . dariqq@posteo.net)
79b8bcd870f61cc79518c4ff8bf560b88661e0b3.1713718938.git.dariqq@posteo.net
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(+)

Toggle diff (51 lines)
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)))
(for-each
(lambda (prog)
(wrap-program (string-append #$output "/bin/" prog)
@@ -9476,6 +9489,7 @@ (define-public gnome-shell
gnome-settings-daemon
graphene
gst-plugins-base
+ gst-plugins-good
ibus
libcanberra
libcroco
@@ -9486,6 +9500,7 @@ (define-public gnome-shell
mesa-headers
mutter
network-manager-applet
+ pipewire
polkit
pulseaudio
python-pygobject

base-commit: a1d711c92e119f6b5b8e99a620cdba92a4ca3bfb
--
2.41.0
D
D
Dariqq wrote on 8 May 14:57 +0200
dde41029-4c1b-4688-aaa5-23c22e61403c@posteo.net
Hi Liliana,

Were you able to take a look at v3 yet? I've sent it a couple of weeks
ago utilizing Glib.setenv to set the gst plugin path.

Have a nice day.

On 21.04.24 14:43, Liliana Marie Prikler wrote:
Toggle quote (14 lines)
> Am Sonntag, dem 21.04.2024 um 12:37 +0000 schrieb Dariqq:
>>>
>> [...]
>> I've just found GLib.setenv() to set environment variables for the
>> process directly from within gjs. The GLib typelib comes from the
>> gobject-introspection package so this should be available.
>>
>> From my limited testing it seems to work (at least for the screencast
>> service). What do you think?
> Yes, GLib.setenv is the function I had in mind to twiddle the
> environment. If you find the right location to do so at the start of
> the program, please send a patch that does that.
>
> Cheers
L
L
Liliana Marie Prikler wrote on 8 May 19:24 +0200
387b26046838cb9968515ded3eeedbf86f1b9558.camel@gmail.com
Am Sonntag, dem 21.04.2024 um 17:02 +0000 schrieb Dariqq:
Toggle quote (61 lines)
> 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
D
D
Dariqq wrote on 8 May 20:33 +0200
[PATCH v4] gnu: gnome-shell: Wrap screencast service.
(address . 70282@debbugs.gnu.org)(name . Dariqq)(address . dariqq@posteo.net)
213d475bd6ad3781baf3876e89bd84c18029dc5e.1715193210.git.dariqq@posteo.net
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 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(+)

Toggle diff (52 lines)
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)))
(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

base-commit: 7b7f299bb493e485c5534b8c554e51d4f3a8c026
--
2.41.0
M
M
Maxim Cournoyer wrote on 8 May 21:51 +0200
(name . Dariqq)(address . dariqq@posteo.net)
87cypw6q0x.fsf@gmail.com
Hi Dariqq,

Dariqq <dariqq@posteo.net> writes:

Toggle quote (11 lines)
> 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!

Toggle quote (42 lines)
> 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.

Toggle quote (20 lines)
> (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
D
D
Dariqq wrote on 8 May 23:18 +0200
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
9e607cae-97fc-4b6d-85bc-dccf58ee1f08@posteo.net
Hi Maxim,

On 08.05.24 21:51, Maxim Cournoyer wrote:
Toggle quote (18 lines)
> Hi Dariqq,
>
> Dariqq <dariqq@posteo.net> 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!
>

The slight annoyance with this is that if pipewire is not running the
option to enable the screen recorder is there but it will stop
immediately. But at least searching online for this problem has some
mentions of pipewire and i added a comment in the pacakge aswell. I
think it is definitly a better solution than not knowing that the option
is even there as the button does not get displayed at all if the service
fails to start.

Toggle quote (47 lines)
>> 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.


The simple patch that would do this is basically the patch from nixos in
v1 of this which adds a shebang line for gjs to the service invocation
files (rather than the dbus service invoking $gjs $service). The problem
then is that wrap-program changes the filename to * .real which makes
gjs unhappy.

The people from nix circumvent this by using some js at the beginning to
reset the entrypoint to the correct value.

One nice way around avoiding the problem would be using wrap-script
instead though that does not support gjs as interpreter (yet?) and
adding that forces a rebuild of all packages due to (guix build utils)
changing.

Maybe another comment, similiar to the one Liliana suggested earlier in
this thread, could be added at the beginning to inform about changing to
wrap script + patch instead once that is a viable option?

Toggle quote (23 lines)
>
>> (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!
>
Have a nice day
L
L
Liliana Marie Prikler wrote on 9 May 00:11 +0200
4593fcd10c303e41eee6afc187e9b5a1baad733f.camel@gmail.com
Hi Dariqq,

Am Mittwoch, dem 08.05.2024 um 21:18 +0000 schrieb Dariqq:
Toggle quote (21 lines)
> [...]
>
> On 08.05.24 21:51, Maxim Cournoyer wrote:
>
> > [...]
> > 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.
>
> The simple patch that would do this is basically the patch from nixos
> in v1 of this which adds a shebang line for gjs to the service
> invocation files (rather than the dbus service invoking $gjs
> $service). The problem then is that wrap-program changes the filename
> to * .real which makes gjs unhappy.
>
> [...]
> Maybe another comment, similiar to the one Liliana suggested earlier
> in this thread, could be added at the beginning to inform about
> changing to wrap script + patch instead once that is a viable option?
The pattern we typically use is to add an autotools-style "variable",
e.g. @GNOME_SHELL_GST_PLUGIN_SYSTEM_PATH@ through a patch, then use
substitute* to fill it in. I don't think it's a requirement, but since
Maxim suggested, it'd definitely be nice to have.

Cheers
D
D
Dariqq wrote on 9 May 10:27 +0200
2957c0c2-29b1-43c4-886f-83623d07c9d0@posteo.net
Hi Liliana,

On 09.05.24 00:11, Liliana Marie Prikler wrote:
Toggle quote (30 lines)
> Hi Dariqq,
>
> Am Mittwoch, dem 08.05.2024 um 21:18 +0000 schrieb Dariqq:
>> [...]
>>
>> On 08.05.24 21:51, Maxim Cournoyer wrote:
>>
>>> [...]
>>> 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.
>>
>> The simple patch that would do this is basically the patch from nixos
>> in v1 of this which adds a shebang line for gjs to the service
>> invocation files (rather than the dbus service invoking $gjs
>> $service). The problem then is that wrap-program changes the filename
>> to * .real which makes gjs unhappy.
>>
>> [...]
>> Maybe another comment, similiar to the one Liliana suggested earlier
>> in this thread, could be added at the beginning to inform about
>> changing to wrap script + patch instead once that is a viable option?

> The pattern we typically use is to add an autotools-style "variable",
> e.g. @GNOME_SHELL_GST_PLUGIN_SYSTEM_PATH@ through a patch, then use
> substitute* to fill it in. I don't think it's a requirement, but since
> Maxim suggested, it'd definitely be nice to have.

How would this work in this case for gnomeshell? Put the js that gets
concatenated here into the actual file with a patch adding placeholder
variables for GST Plugin path and gi typelib path and replace later?

As these js files get generated from a common template for each service
this would require substituting all of them and not only the screencast
service.


Toggle quote (3 lines)
>
> Cheers
>
M
M
Maxim Cournoyer wrote on 9 May 17:30 +0200
(name . Dariqq)(address . dariqq@posteo.net)
87a5kz2eb6.fsf@gmail.com
Hi Dariqq,

Dariqq <dariqq@posteo.net> writes:

[...]

Toggle quote (49 lines)
>>> 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.
>
>
> The simple patch that would do this is basically the patch from nixos
> in v1 of this which adds a shebang line for gjs to the service
> invocation files (rather than the dbus service invoking $gjs
> $service). The problem then is that wrap-program changes the filename
> to * .real which makes gjs unhappy.
>
> The people from nix circumvent this by using some js at the beginning
> to reset the entrypoint to the correct value.
>
> One nice way around avoiding the problem would be using wrap-script
> instead though that does not support gjs as interpreter (yet?) and
> adding that forces a rebuild of all packages due to (guix build utils)
> changing.

It'd be nice to prep such support on core-updates. You can test it on
master by having a (guix build utils-next) module that you explicitly
use.

Toggle quote (4 lines)
> Maybe another comment, similiar to the one Liliana suggested earlier
> in this thread, could be added at the beginning to inform about
> changing to wrap script + patch instead once that is a viable option?

That could be a good reminder to have, yes.

--
Thanks,
Maxim
D
D
Dariqq wrote on 10 May 16:59 +0200
532cafdd-afc3-4c2b-bd4a-a2be3318747c@posteo.net
Hi Liliana and Maxim,

On 09.05.24 00:11, Liliana Marie Prikler wrote:
Toggle quote (30 lines)
> Hi Dariqq,
>
> Am Mittwoch, dem 08.05.2024 um 21:18 +0000 schrieb Dariqq:
>> [...]
>>
>> On 08.05.24 21:51, Maxim Cournoyer wrote:
>>
>>> [...]
>>> 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.
>>
>> The simple patch that would do this is basically the patch from nixos
>> in v1 of this which adds a shebang line for gjs to the service
>> invocation files (rather than the dbus service invoking $gjs
>> $service). The problem then is that wrap-program changes the filename
>> to * .real which makes gjs unhappy.
>>
>> [...]
>> Maybe another comment, similiar to the one Liliana suggested earlier
>> in this thread, could be added at the beginning to inform about
>> changing to wrap script + patch instead once that is a viable option?
> The pattern we typically use is to add an autotools-style "variable",
> e.g. @GNOME_SHELL_GST_PLUGIN_SYSTEM_PATH@ through a patch, then use
> substitute* to fill it in. I don't think it's a requirement, but since
> Maxim suggested, it'd definitely be nice to have.
>

Tried this today and as the js service files are created from a common
template using mesons 'configure_file' method this sets all
autotools-style variables unknown to meson to the empty string.
Afterwardes the susbtitute* at the wrapping phase is unable to replace
anything ofc.

So I think I would need to either change the naming-scheme of the
placeholders or substitute them into the template file before the files
get configured by meson.

Do you have a preference for any option (or maybe another idea)?

Toggle quote (2 lines)
> Cheers
>
Have a nice day
L
L
Liliana Marie Prikler wrote on 10 May 18:04 +0200
9717bead5b1eb65af01143131e7e46fe835ab682.camel@gmail.com
Am Freitag, dem 10.05.2024 um 14:59 +0000 schrieb Dariqq:
Toggle quote (49 lines)
> Hi Liliana and Maxim,
>
> On 09.05.24 00:11, Liliana Marie Prikler wrote:
> > Hi Dariqq,
> >
> > Am Mittwoch, dem 08.05.2024 um 21:18 +0000 schrieb Dariqq:
> > > [...]
> > >
> > > On 08.05.24 21:51, Maxim Cournoyer wrote:
> > >
> > > > [...]
> > > > 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.
> > >
> > > The simple patch that would do this is basically the patch from
> > > nixos
> > > in  v1 of this which adds a shebang line for gjs to the service
> > > invocation files (rather than the dbus service invoking $gjs
> > > $service). The problem then is that wrap-program changes the
> > > filename
> > > to * .real which makes gjs unhappy.
> > >
> > > [...]
> > > Maybe another comment, similiar to the one Liliana suggested
> > > earlier
> > > in this thread, could be added at the beginning to inform about
> > > changing to wrap script + patch instead once that is a viable
> > > option?
> > The pattern we typically use is to add an autotools-style
> > "variable",
> > e.g. @GNOME_SHELL_GST_PLUGIN_SYSTEM_PATH@ through a patch, then use
> > substitute* to fill it in.  I don't think it's a requirement, but
> > since
> > Maxim suggested, it'd definitely be nice to have.
> >
>
> Tried this today and as the js service files are created from a
> common template using mesons 'configure_file' method this sets all
> autotools-style variables unknown to meson to the empty string.
> Afterwardes the susbtitute* at the wrapping phase is unable to
> replace anything ofc.
>
> So I think I would need to either change the naming-scheme of the
> placeholders or substitute them into the template file  before the
> files get configured by meson.
Or you add an option to meson_options.txt to fill it in, so that you
can provide the right value via #:configure-flags

Cheers
D
D
Dariqq wrote on 11 May 10:03 +0200
44b03f63-e82c-4f62-9d92-3d64007c3f10@posteo.net
On 10.05.24 18:04, Liliana Marie Prikler wrote:
Toggle quote (53 lines)
> Am Freitag, dem 10.05.2024 um 14:59 +0000 schrieb Dariqq:
>> Hi Liliana and Maxim,
>>
>> On 09.05.24 00:11, Liliana Marie Prikler wrote:
>>> Hi Dariqq,
>>>
>>> Am Mittwoch, dem 08.05.2024 um 21:18 +0000 schrieb Dariqq:
>>>> [...]
>>>>
>>>> On 08.05.24 21:51, Maxim Cournoyer wrote:
>>>>
>>>>> [...]
>>>>> 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.
>>>>
>>>> The simple patch that would do this is basically the patch from
>>>> nixos
>>>> in  v1 of this which adds a shebang line for gjs to the service
>>>> invocation files (rather than the dbus service invoking $gjs
>>>> $service). The problem then is that wrap-program changes the
>>>> filename
>>>> to * .real which makes gjs unhappy.
>>>>
>>>> [...]
>>>> Maybe another comment, similiar to the one Liliana suggested
>>>> earlier
>>>> in this thread, could be added at the beginning to inform about
>>>> changing to wrap script + patch instead once that is a viable
>>>> option?
>>> The pattern we typically use is to add an autotools-style
>>> "variable",
>>> e.g. @GNOME_SHELL_GST_PLUGIN_SYSTEM_PATH@ through a patch, then use
>>> substitute* to fill it in.  I don't think it's a requirement, but
>>> since
>>> Maxim suggested, it'd definitely be nice to have.
>>>
>>
>> Tried this today and as the js service files are created from a
>> common template using mesons 'configure_file' method this sets all
>> autotools-style variables unknown to meson to the empty string.
>> Afterwardes the susbtitute* at the wrapping phase is unable to
>> replace anything ofc.
>>
>> So I think I would need to either change the naming-scheme of the
>> placeholders or substitute them into the template file  before the
>> files get configured by meson.
> Or you add an option to meson_options.txt to fill it in, so that you
> can provide the right value via #:configure-flags

I'd want to avoid putting the environement variables together myself and
rather use getenv to retrieve the value at build time though. Don't
think that would work with #:configure-flags

Toggle quote (3 lines)
>
> Cheers

Have a nice day
L
L
Liliana Marie Prikler wrote on 14 May 07:34 +0200
c3ac5f23668dcb9201a43cb8d4b075baa92a2535.camel@gmail.com
Am Donnerstag, dem 09.05.2024 um 11:30 -0400 schrieb Maxim Cournoyer:
Toggle quote (78 lines)
> Hi Dariqq,
>
> Dariqq <dariqq@posteo.net> writes:
>
> [...]
>
> > > > 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.
> >
> >
> > The simple patch that would do this is basically the patch from
> > nixos in v1 of this which adds a shebang line for gjs to the
> > service invocation files (rather than the dbus service invoking
> > $gjs $service). The problem then is that wrap-program changes the
> > filename to * .real which makes gjs unhappy.
> >
> > The people from nix circumvent this by using some js at the
> > beginning to reset the entrypoint to the correct value.
> >
> > One nice way around avoiding the problem would be using wrap-script
> > instead though that does not support gjs as interpreter (yet?) and
> > adding that forces a rebuild of all packages due to (guix build
> > utils) changing.
>
> It'd be nice to prep such support on core-updates.  You can test it
> on master by having a (guix build utils-next) module that you
> explicitly use.
>
> > Maybe another comment, similiar to the one Liliana suggested
> > earlier in this thread, could be added at the beginning to inform
> > about changing to wrap script + patch instead once that is a viable
> > option?
>
> That could be a good reminder to have, yes.
I've pushed the current version as-is, without reminder, so that we can
at least mark the issue done. If someone has a good text to add,
please don't hesitate to do so in post. Also don't hesitate to submit
new stuff to gnome-team or core-updates after the pending merges are
through.

Cheers and thanks for all the hard work :)
Closed
?