如何开始编写 Gnome Shell 扩展
我发现很难找到有关 Gnome Shell 扩展的文档。我在 Gnome Wiki 上找到了一些内容(并且是一级链接),但并不多:
http:// live.gnome.org/GnomeShell/Extensions
这里的问题是 GJS 及其绑定。绝对没有文档,有很多 SIGSEGV,绑定还没有准备好(GLib、Gio 等)。唯一有效的文档是 GIR 生成的用于 Seed JavaScript 实现的非官方文档:
http:// /roojs.org/seed/gir-1.2-gtk-2.0/seed/
哪里可以获得更多示例?我想要读取目录、文件、生成进程、打开网络套接字以及执行其他操作。
更新:向我展示如何在 GJS 中逐行读取文件。根据 Google 的说法,这是不可能的。谢谢。
I have found it's very hard to find documentation about Gnome Shell Extensions. I found some bits on Gnome Wiki (and it's first-level links), but it's not much:
http://live.gnome.org/GnomeShell/Extensions
The problem here is GJS and it's bindings. Absolutely no documentation, got lot's of SIGSEGVs, binding is just not ready (GLib, Gio and others). The only working one is unofficial documentation generated from GIR for Seed JavaScript implementation:
http://roojs.org/seed/gir-1.2-gtk-2.0/seed/
Where to get more examples? I want read directories, files, spawn processes, open network sockets and do other stuff.
Update: Show me how to read a file line by line in GJS. According Google this is not possible. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
GNOME Shell 使用 GJS,而不是 Seed >。两者之间存在一些差异,这可能可以解释您遇到问题的原因。
通过 GOBject Introspection,您可以阅读原始库的文档,并根据您正在使用的语言调整每个方法/函数的签名。
在您的特定情况下,对于文件、网络等,您可能需要检查 GIO。您可以查看平台概述以了解其他可用的内容。您还可以在 JavaScript 中查看一些示例(但不是扩展) 。
最后但并非最不重要的一点是,很快就会推出带有扩展程序的网站。
GNOME Shell uses GJS, not Seed. There are some differences among both of them, and it might explain why you are having problems.
With GOBject Introspection you can read the documentation for the original library and adapt the signature of every method/function to the language you are using.
In your particular case, for files, networking, etc. you might want to check GIO. You can check the Platform Overview to check what else is available. You also can check some examples (not extensions, though) in JavaScript.
At last but not least, very soon a website with extension will be launched.
嗯,据说,使用 Gnome3,您可以在各种编程语言中拥有一个非常统一的 API,它是从相同的 GIR 文件生成的。因此,您应该(至少在理论上)能够从 GObject Introspection 检索所有 API(我希望有文档)。
反之,您应该能够轻松地将示例代码从另一种语言转换为此 API 的 JavaScript。
理论上来说。我尽可能避免使用 JavaScript,用 JavaScript 开发桌面应用程序是我最不愿意做的事情。
Well, supposedly, with Gnome3, you have a pretty uniform API across various programming languages, that is generated from the same GIR files. So you should (at least in theory) be able to retrieve all the API - I hope with documentation - from the GObject Introspection.
And the other way round, you should be able to transform example code from another language into JavaScript for this API easily.
Theoretically. I avoid JavaScript where possible, developing a desktop application in JavaScript is the last I would do.