View Single Post
Copernicus's Avatar
Posts: 1,986 | Thanked: 7,698 times | Joined on Dec 2010 @ Dayton, Ohio
#16
Alright, I've finally managed to create a Maemo homescreen widget. Version 0.9.0 of Fettuccine is now making its way up to Extras-Devel, and should hopefully allow you to run it as a widget; at least, it is working for me.



Some notes: (a) While Fettuccine uses very little CPU, it does take up a bit of memory (top reports a bit less than 10% for most of my testing). So, it wouldn't take too many desktop widget instances to eat up all your ram. (It may be possible to drive multiple views from a single Fettuccine executable, but it doesn't look pretty; Maemo seems to favor the "one widget, one view" policy...)

(b) This is my first ever Maemo homescreen widget, so I'm absolutely positive there will be bugs. Please be patient with me!

(c) I don't really use widgets for, well, anything on my N900s. I'm sure there are general conventions on usage and UI design that I'm missing. Right now, each widget can be modified via a dialog box that comes up when you hit the little "wrench" icon that comes up after a long-press on the screen (or, I guess, double-click the screen and then click the gear icon that drops down). From this dialog box you can access most of the same controls that are available on the Fettuccine menu, as well as change the size of the widget. Hopefully, this will be sufficient for playing around with the widget for now...

Some implementation notes: the "qt4-homescreen-loader" package makes widget generation very easy. In fact, it makes it easy to create an app that doubles as a widget, which is what I have in fact done with Fettuccine. If you pass it the command-line argument "--runAsApp", Fettuccine will start up as a normal app; otherwise, it will attempt to start running as a widget. (As it turns out, I couldn't use the argument "--runAsWidget", because there appears to be no way to pass arguments to a widget...) There are some annoying stumbling blocks as well; all of the standard Maemo widgets set the attribute "X-Multiple-Instances=false" in their .desktop files. Since I wanted to allow multiple instances, I set that attribute to true in my .desktop file. This was completely useless, as it turns out actual attribute is just "X-Multiple"; so, that line in all the standard widgets is just a no-op. I spent a few frustrating hours trying to figure out that one... Another subtle issue is that if your widget brings up a dialog box (such as for the settings), you must not give that dialog box a parent pointer. If you set the widget as the dialog's parent, mouse events will get scattered among the various objects on the screen rather than being focussed on the dialog box. (This is apparently a side effect of the technique that "qt4-homescreen-loader" uses to communicate with the Hildon desktop.)

So, anyway, hopefully this will be a useful and enjoyable addition to the Fettuccine app.

EDIT: A little youtube video with a quick overview of Fettuccine:

http://youtu.be/0URUZZ50s7o

Last edited by Copernicus; 2014-07-05 at 23:24. Reason: Added youtube video
 

The Following 12 Users Say Thank You to Copernicus For This Useful Post: