3

I'd like to use Gvc (libgnome-volume-control) as used in Gnome Shell GIR in GJS, but can't find a way to access it except within the Gnome Shell environment (eg. a Gnome Shell extension). Actually, I can't even figure out where it is. Is this possible?

UPDATE

In line with Philip Withnall's comment (about a hacky workaround), I have found it's possible to import like so:

const GIRepository = imports.gi.GIRepository;
GIRepository.Repository.prepend_search_path("/usr/lib/gnome-shell");
GIRepository.Repository.prepend_library_path("/usr/lib/gnome-shell");
const Gvc = imports.gi.Gvc;
andy.holmes
  • 3,383
  • 17
  • 28

1 Answers1

2

Yes.

libgnome-volume-control is currently only meant to be used as a submodule. gnome-shell lists it in its .gitmodules file to import the code, and then in meson.build to build it.

It should be possible to use libgnome-volume-control in your project similarly.

(I determined this using git grep -i gvc on the gnome-shell code.)

Philip Withnall
  • 5,293
  • 14
  • 28
  • Ah, unfortunately my project is a GJS (only) shell extension, just with a GJS daemon running outside the Shell environment (since shell extensions are disabled on "session-mode" changes). Still answers my question though, thanks for the quick reply. – andy.holmes Oct 10 '17 at 20:53
  • Can you not compile libgvc as a submodule and ship the `.so` and `.typelib` privately alongside your daemon? – Philip Withnall Oct 10 '17 at 21:54
  • I think that would be architecture dependant no? Even if not, the extent of transparency in the extensions.gnome.org review process is generally "do work"->"reject/accept". I wonder if I could file a bug about shipping it separately since that's what Cinnamon/Mint seems to do (gir1.2-cvc-1.0 in ubuntu repos), or if there's a good reason it's submodule-only. – andy.holmes Oct 11 '17 at 00:25
  • It would indeed be architecture-dependent. Sorry, I didn’t realise you were shipping everything inside the shell extension archive. You might be able to do some hackery by changing the `GI_TYPELIB_PATH` to include gnome-shell’s private typelib directory (which contains the libgvc typelib — look at what files your distribution’s gnome-shell package installs) so you can include it from your extension. However, that is horrifically hacky. I suggest that in any case you get in touch with Florian Müllner and ask him about making libgvc public. He’s on IRC most of the time. – Philip Withnall Oct 11 '17 at 08:42
  • Well, will be good to me also, if the library can be public. I hate to see something that can be shared just hided. – lestcape Aug 13 '18 at 22:20