Attention: Applet, Desklet, Extension developers…
by mtwebster 6

Please, sit down.

We’re breaking API. Specifically, anything that uses imports.dbus.

No wait, wait! Before you get out your pitchforks, this is necessary to modernize our JS language bindings (cjs) or (possibly) eliminate cjs and just use upstream gjs. The old dbus bindings that we were using were becoming progressively more out-of-date with respect to the underlying dbus system, causing random freezes, deadlocks, and other nasty things. Also, as the JS implementation we use evolved, upstream gjs has become much better at garbage collection and memory management.

On my development branch for this, which is running upstream gjs currently, I’ve had no freezes, no crashes, a smaller memory footprint for Cinnamon (with less growth), and it’s seemed actually faster overall (though this is only empirical.) I think this will be a very positive thing for the health and future of Cinnamon.

Any applet that currently uses imports.dbus will need to switch over to Gio.DBus instead. It appears superior, and actually simplifies code in many places. I’ve added sort of a library for common dbus interfaces (like those provided by cinnamon-settings-daemon, and media player interfaces) – you can see it here. I’d like to attempt to keep these in one place, and not have them duplicated across applets and whatnot – this way, if the interfaces change, we need only fix them here, instead of applet devs (or users) trying to figure out what changed. I also provided easy constructors for these – both synchronous and asynchronous. However, unless you have an extremely good reason not to, always use the async methods, to prevent any blocking of the Cinnamon thread. This actually applies to any type of i/o operation – never use synchronous.

All of Cinnamon has been ported over (at least that I can find!) So there should be plenty of examples of how to make the switch. I’ll do whatever I can to help out, answer questions, debug, whatever, to get you moved over (#linuxmint-dev on Spotchat IRC, miketwebster@gmail.com).

One thing to note… I’ve just scratched the surface with my dbus knowledge – this effort was a decent learning experience, but feel free to make suggestions or corrections.

The only serious issue I’ve run into so far, is that properties can supposedly now be accessed simply by foo = proxy.SomeProperty. In practice, this doesn’t work reliably – specifically for org.mpris.MediaPlayer.* providers so far. I’m almost certain it’s just buggy implementations on the music players’ parts – Audacious, for instance, works just fine, while banshee, clementine, and vlc (and perhaps more) don’t seem to notify of updates to some or all of their properties. To work around this, I have to basically resort to the old behavior, using the org.freedesktop.DBus.Properties interface to perform a Get on the property I want – it works fine when I do this. If you look at the stock sound applet, you’ll see where this has been done.

These changes could land in master as early as this weekend yet, but probably not until sometime this coming week. If you want to see how it runs, you can check out my branch. You’ll have to be running the latest of all other Cinnamon dependencies, as well as install the gjs and gjd-development packages for building and running.

Backwards Compatibility

We need to do a small maintenance release to current cjs, hopefully this coming week.  Once this has been done, your newly-migrated applet should remain 100% compatible with the current Cinnamon release.  Although for now, you’ll have to supply your own interfaces.

We don’t do this lightly – we’ve always tried our best to not break applets and extensions, but this actually should have been done a couple of releases ago (it was complicated by having to support older Mint releases at the time), and I think, in this case, that the benefits outweigh the costs.

Thanks.

 

6 thoughts on “Attention: Applet, Desklet, Extension developers…

  1. Reply Borsook Aug 10,2014 19:34

    Will the future version of Cinnamon have any safeguards against installing applets etc that were not updated?

    • Reply mtwebster Aug 10,2014 23:11

      Nothing as of yet – they’ll just not load and throw an error currently. Maybe a notification? This is another area to be addressed soon hopefully, reporting and recovering from errors like an applet crashing, etc… instead of just dumping to a log.

      Fortunately, there don’t see to be that many applets, desklets, etc… out there using dbus in the first place – I’m hoping with enough outreach this won’t be a problem by the time the next release comes.

  2. Reply Sam Burgos Aug 11,2014 15:00

    But by using gjs doesn’t that mean that you have to keep some GNOME dependencies in Cinnamon? As far as I know in Mint you still got some GNOME-things, specially gnome-settings-daemon and gnome-settings-daemon-schemas if I’m not wrong, but having some apps depending from it is not something good.

    I’m not saying that with this Cinnamon sucks or something (a.k.a trolling) but could be great if Cinnamon can be less GNOME dependent that it is today but I guess that’s up to you to work out this things and figure how to improve every cycle

    • Reply mtwebster Aug 11,2014 15:37

      We have no real gnome dependencies at this point, other than some utilities (gnome-keyring) and other things it just doesn’t make sense to fork, and some applications (gnome-terminal).

      Everything else we forked a few releases ago, so this isn’t really an issue anymore.

      Gjs is a bit different – it’s maintained by the gnome folks, but it’s a language binding – it doesn’t really have ‘features.’ The language (in this case Mozilla js) is now at version X.X, but we were using bindings from version Y.Y.

      Also, since we’re on a stable base, any dependencies we do have remain the same for the life of our release cycle.

      We’ve never forked because we wanted to, we tried to have good reason. Unforking can be just as beneficial, if we’re comfortable with the results – it means less maintenance, and more time to work on other areas.

  3. Reply william wright Nov 3,2014 04:12

    Hi. I have an issue with someone compromising my network about 2 years ago. They have done something to make any machine that is exposed to my work and home networks the Bios or Mother Board. I can only assume they are using a nearby router, my phone,or my television or sattelight DVR to re-infect. Excuse me if my terminology is off. Any help would be much appreciated and possibly compensated. Thanks for your time.

  4. Reply lestcape Nov 6,2014 07:05

    If some want to use the old Dbus and at the same time Gio.DBus to maintain compatibility with older cinnamon version, this certainly can be done, without a problem… here you can found an hybrid model:

    https://github.com/lestcape/Drives-Manager/blob/master/drivesManager%40lestcape/system.js

    This work on cinnamon 2.2 and 2.4 at the same time.

Leave a Reply