问题
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;
回答1:
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.)
来源:https://stackoverflow.com/questions/46674935/is-it-possible-to-import-the-gvc-typelib-outside-of-the-gnome-shell-environment