How to start writing Gnome Shell extensions
Asked Answered
T

2

31

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.

Tirrell answered 28/11, 2011 at 20:5 Comment(4)
@Anonymouse I'm still on Gnome 2.x. All the new (backwards) WMs really don't like dual displays, for one thing.Bobbette
Granted, when you are running it on a tablet, Gnome3 may be nicer to use.Solstice
This seems a useful tutorialSidhu
this is what I've done: abidibo.net/blog/2016/03/02/…Otterburn
A
15

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.

Amino answered 29/11, 2011 at 3:21 Comment(2)
Thanks, I know it, but the website is new information for me.Tirrell
Okay marking as answered. No new information for me, but maybe for others. Thanks :-)Tirrell
S
1

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.

Solstice answered 28/11, 2011 at 20:19 Comment(1)
Should be possible: from gi.repository import GObject etc.Solstice

© 2022 - 2024 — McMap. All rights reserved.