GNU bug report logs - #70282
[PATCH 0/2] Fix gnome-shell screenrecorder

Previous Next

Package: guix-patches;

Reported by: Dariqq <dariqq <at> posteo.net>

Date: Mon, 8 Apr 2024 15:50:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 70282 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to liliana.prikler <at> gmail.com, maxim.cournoyer <at> gmail.com, rg <at> raghavgururajan.name, vivien <at> planete-kraus.eu, guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Mon, 08 Apr 2024 15:50:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dariqq <dariqq <at> posteo.net>:
New bug report received and forwarded. Copy sent to liliana.prikler <at> gmail.com, maxim.cournoyer <at> gmail.com, rg <at> raghavgururajan.name, vivien <at> planete-kraus.eu, guix-patches <at> gnu.org. (Mon, 08 Apr 2024 15:50:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: guix-patches <at> gnu.org
Cc: rekado <at> elephly.net, Dariqq <dariqq <at> posteo.net>
Subject: [PATCH 0/2] Fix gnome-shell screenrecorder
Date: Mon,  8 Apr 2024 15:39:06 +0000
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.

[1] https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/desktops/gnome/core/gnome-shell/wrap-services.patch 

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





Information forwarded to liliana.prikler <at> gmail.com, maxim.cournoyer <at> gmail.com, rg <at> raghavgururajan.name, vivien <at> planete-kraus.eu, guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Mon, 08 Apr 2024 15:55:02 GMT) Full text and rfc822 format available.

Message #8 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: 70282 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Dariqq <dariqq <at> posteo.net>
Subject: [PATCH 1/2] gnu: gnome-shell: Wrap d-bus services.
Date: Mon,  8 Apr 2024 15:53:51 +0000
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

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





Information forwarded to liliana.prikler <at> gmail.com, maxim.cournoyer <at> gmail.com, rg <at> raghavgururajan.name, vivien <at> planete-kraus.eu, guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Mon, 08 Apr 2024 15:55:02 GMT) Full text and rfc822 format available.

Message #11 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: 70282 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Dariqq <dariqq <at> posteo.net>
Subject: [PATCH 2/2] gnu: gnome-essential-extras: Propagate pipewire.
Date: Mon,  8 Apr 2024 15:53:52 +0000
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
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Mon, 08 Apr 2024 16:50:03 GMT) Full text and rfc822 format available.

Message #14 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Dariqq <dariqq <at> posteo.net>, 70282 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Raghav Gururajan <rg <at> raghavgururajan.name>,
 Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH 2/2] gnu: gnome-essential-extras: Propagate
 pipewire.
Date: Mon, 08 Apr 2024 18:49:02 +0200
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.

Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Mon, 08 Apr 2024 16:55:01 GMT) Full text and rfc822 format available.

Message #17 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Dariqq <dariqq <at> posteo.net>, 70282 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Raghav Gururajan <rg <at> raghavgururajan.name>,
 Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH 1/2] gnu: gnome-shell: Wrap d-bus services.
Date: Mon, 08 Apr 2024 18:54:29 +0200
Am Montag, dem 08.04.2024 um 15:53 +0000 schrieb Dariqq:
> 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].

> 
> 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
>              (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?
> + 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

Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Tue, 09 Apr 2024 14:06:01 GMT) Full text and rfc822 format available.

Message #20 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 70282 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Raghav Gururajan <rg <at> raghavgururajan.name>,
 Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH 2/2] gnu: gnome-essential-extras: Propagate
 pipewire.
Date: Tue,  9 Apr 2024 14:05:17 +0000
On 08.04.24 18:49, Liliana Marie Prikler wrote:
> 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?




Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Tue, 09 Apr 2024 15:36:03 GMT) Full text and rfc822 format available.

Message #23 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 70282 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Raghav Gururajan <rg <at> raghavgururajan.name>,
 Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH 1/2] gnu: gnome-shell: Wrap d-bus services.
Date: Tue,  9 Apr 2024 15:35:11 +0000
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.




Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Tue, 09 Apr 2024 17:05:02 GMT) Full text and rfc822 format available.

Message #26 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Dariqq <dariqq <at> posteo.net>, 70282 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Raghav Gururajan <rg <at> raghavgururajan.name>,
 Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH 1/2] gnu: gnome-shell: Wrap d-bus services.
Date: Tue, 09 Apr 2024 19:04:16 +0200
Am Dienstag, dem 09.04.2024 um 15:35 +0000 schrieb Dariqq:
> 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




Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Wed, 10 Apr 2024 08:08:03 GMT) Full text and rfc822 format available.

Message #29 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 70282 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Raghav Gururajan <rg <at> raghavgururajan.name>,
 Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH 1/2] gnu: gnome-shell: Wrap d-bus services.
Date: Wed, 10 Apr 2024 08:07:08 +0000

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?

Have a nice day.




Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Wed, 10 Apr 2024 18:21:03 GMT) Full text and rfc822 format available.

Message #32 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Dariqq <dariqq <at> posteo.net>, 70282 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Raghav Gururajan <rg <at> raghavgururajan.name>,
 Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH 1/2] gnu: gnome-shell: Wrap d-bus services.
Date: Wed, 10 Apr 2024 20:20:06 +0200
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.

Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Thu, 11 Apr 2024 09:06:02 GMT) Full text and rfc822 format available.

Message #35 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 70282 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Raghav Gururajan <rg <at> raghavgururajan.name>,
 Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH 1/2] gnu: gnome-shell: Wrap d-bus services.
Date: Thu, 11 Apr 2024 09:04:46 +0000
Hi,

On 10.04.24 20:20, Liliana Marie Prikler wrote:
> 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.

> Cheers

Have a nice day




Information forwarded to liliana.prikler <at> gmail.com, maxim.cournoyer <at> gmail.com, vivien <at> planete-kraus.eu, guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Fri, 12 Apr 2024 17:48:03 GMT) Full text and rfc822 format available.

Message #38 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: 70282 <at> debbugs.gnu.org
Cc: Dariqq <dariqq <at> posteo.net>
Subject: [PATCH v2] gnu: gnome-shell: Wrap screencast service.
Date: Fri, 12 Apr 2024 17:26:48 +0000
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Fri, 19 Apr 2024 18:52:04 GMT) Full text and rfc822 format available.

Message #41 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Dariqq <dariqq <at> posteo.net>, 70282 <at> debbugs.gnu.org
Cc: Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH v2] gnu: gnome-shell: Wrap screencast service.
Date: Fri, 19 Apr 2024 20:51:36 +0200
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…)  What keeps you from wrapping the environment
variable in Javascript?

> 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





Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Sat, 20 Apr 2024 10:13:04 GMT) Full text and rfc822 format available.

Message #44 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 70282 <at> debbugs.gnu.org
Cc: Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH v2] gnu: gnome-shell: Wrap screencast service.
Date: Sat, 20 Apr 2024 10:11:43 +0000

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).

  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).

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.

>> 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.




Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Sat, 20 Apr 2024 10:47:03 GMT) Full text and rfc822 format available.

Message #47 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Dariqq <dariqq <at> posteo.net>, 70282 <at> debbugs.gnu.org
Cc: Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH v2] gnu: gnome-shell: Wrap screencast service.
Date: Sat, 20 Apr 2024 12:46:25 +0200
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 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.

> 
Cheers

Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Sun, 21 Apr 2024 12:39:02 GMT) Full text and rfc822 format available.

Message #50 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, 70282 <at> debbugs.gnu.org
Cc: Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH v2] gnu: gnome-shell: Wrap screencast service.
Date: Sun, 21 Apr 2024 12:37:46 +0000

On 20.04.24 12:46, Liliana Marie Prikler wrote:
> 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.

>> 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?

> Cheers

Have a nice day.




Information forwarded to guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Sun, 21 Apr 2024 12:44:02 GMT) Full text and rfc822 format available.

Message #53 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Dariqq <dariqq <at> posteo.net>, 70282 <at> debbugs.gnu.org
Cc: Vivien Kraus <vivien <at> planete-kraus.eu>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#70282] [PATCH v2] gnu: gnome-shell: Wrap screencast service.
Date: Sun, 21 Apr 2024 14:43:13 +0200
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




Information forwarded to liliana.prikler <at> gmail.com, maxim.cournoyer <at> gmail.com, vivien <at> planete-kraus.eu, guix-patches <at> gnu.org:
bug#70282; Package guix-patches. (Sun, 21 Apr 2024 17:11:04 GMT) Full text and rfc822 format available.

Message #56 received at 70282 <at> debbugs.gnu.org (full text, mbox):

From: Dariqq <dariqq <at> posteo.net>
To: 70282 <at> debbugs.gnu.org
Cc: Dariqq <dariqq <at> posteo.net>
Subject: [PATCH v3] gnu: gnome-shell: Wrap screencast service.
Date: Sun, 21 Apr 2024 17:02:18 +0000
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)))
                   (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





This bug report was last modified 13 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.