Experience from writing a tiny GNOME app in Gjs
Robin Stocker <robin <at> nibor.org>
2013-07-12 16:54:53 GMT
I wrote a tiny app in Gjs yesterday and wanted to share my experience.
It's a wrapper around the Spotify web player to add support for media
keys (play/pause, next, previous). It uses Gtk, WebKitGTK+ 2, and DBus.
I started with the gnome-devel-demos , which gives a very nice
introduction. The hello world was running quickly and the edit/run cycle
is of course very fast due to not needing compilation.
For adding media key support, I looked at what totem does , and tried
to reproduce it. This is where I hit the first road block, there's no
API reference for JS on developer.gnome.org. But I think this should be
addressed with bug 693378. Through searching I found some documentation
which helped  (although some things didn't work as documented).
For the WebKitGTK+ API, I looked at the C API reference and puzzled it
out. This was also kind of hard, but it's the same problem as above.
For making it easy to install this, I experimented with a .desktop file
which references the .js and icon through relative paths, but had no
success. I resorted to having an install.sh that expands the paths and
copies the file to ~/.local/share/applications/. I'm eagerly awaiting
the "app bundles" work, which should improve the situation .
All in all, I think the GNOME platform is moving in the right direction
and there's potential in having a good app development story.
Finally, here's the link to the source, if anyone is interested: