all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dariqq <dariqq@posteo.net>
To: Liliana Marie Prikler <liliana.prikler@gmail.com>, 70282@debbugs.gnu.org
Cc: Vivien Kraus <vivien@planete-kraus.eu>,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#70282] [PATCH v2] gnu: gnome-shell: Wrap screencast service.
Date: Sun, 21 Apr 2024 12:37:46 +0000	[thread overview]
Message-ID: <8e84c417-825a-416a-8ca0-ed5aebda489e@posteo.net> (raw)
In-Reply-To: <7a635b027f59d348312098650d1606f2e658ffab.camel@gmail.com>



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.




  reply	other threads:[~2024-04-21 12:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08 15:39 [bug#70282] [PATCH 0/2] Fix gnome-shell screenrecorder Dariqq
2024-04-08 15:53 ` [bug#70282] [PATCH 1/2] gnu: gnome-shell: Wrap d-bus services Dariqq
2024-04-08 16:54   ` Liliana Marie Prikler
2024-04-09 15:35     ` Dariqq
2024-04-09 17:04       ` Liliana Marie Prikler
2024-04-10  8:07         ` Dariqq
2024-04-10 18:20           ` Liliana Marie Prikler
2024-04-11  9:04             ` Dariqq
2024-04-08 15:53 ` [bug#70282] [PATCH 2/2] gnu: gnome-essential-extras: Propagate pipewire Dariqq
2024-04-08 16:49   ` Liliana Marie Prikler
2024-04-09 14:05     ` Dariqq
2024-04-12 17:26 ` [bug#70282] [PATCH v2] gnu: gnome-shell: Wrap screencast service Dariqq
2024-04-19 18:51   ` Liliana Marie Prikler
2024-04-20 10:11     ` Dariqq
2024-04-20 10:46       ` Liliana Marie Prikler
2024-04-21 12:37         ` Dariqq [this message]
2024-04-21 12:43           ` Liliana Marie Prikler
2024-05-08 12:57             ` [bug#70282] [PATCH v3] " Dariqq
2024-04-21 17:02 ` Dariqq
2024-05-08 17:24   ` Liliana Marie Prikler
2024-05-08 18:33 ` [bug#70282] [PATCH v4] " Dariqq
2024-05-08 19:51   ` Maxim Cournoyer
2024-05-08 21:18     ` Dariqq
2024-05-08 22:11       ` Liliana Marie Prikler
2024-05-09  8:27         ` Dariqq
2024-05-10 14:59         ` Dariqq
2024-05-10 16:04           ` Liliana Marie Prikler
2024-05-11  8:03             ` Dariqq
2024-05-09 15:30       ` Maxim Cournoyer
2024-05-14  5:34         ` bug#70282: " Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e84c417-825a-416a-8ca0-ed5aebda489e@posteo.net \
    --to=dariqq@posteo.net \
    --cc=70282@debbugs.gnu.org \
    --cc=liliana.prikler@gmail.com \
    --cc=maxim.cournoyer@gmail.com \
    --cc=vivien@planete-kraus.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.