是否可以在Gnome Shell环境之外导入Gvc typelib? [英] Is it possible to import the Gvc typelib outside of the Gnome Shell environment?
问题描述
我想使用Gvc( libgnome-volume-control )<在Gnome Shell中使用的href ="https://github.com/GNOME/gnome-shell/blob/master/js/ui/status/volume.js" rel ="nofollow noreferrer"> GIR GJS,但是除了在Gnome Shell环境(例如,Gnome Shell扩展)内,找不到其他方法来访问它.实际上,我什至不知道它在哪里.这可能吗?
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?
更新
符合Philip Withnall的评论(关于一个怪异的解决方法),我发现可以像这样导入:
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;
推荐答案
是.
libgnome-volume-control是目前仅意味着用作子模块. gnome-shell在
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.
应该可以在项目中类似地使用libgnome-volume-control.
It should be possible to use libgnome-volume-control in your project similarly.
(我在gnome-shell代码上使用git grep -i gvc
确定了这一点.)
(I determined this using git grep -i gvc
on the gnome-shell code.)
这篇关于是否可以在Gnome Shell环境之外导入Gvc typelib?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!