IP Address Widget for Harmattan
Based on my experiments with the
Calendar Icon Hack,
this takes the concept one step further and provides a "Widget" for
your Harmattan (N950/N9) application screen that shows your current
IP address(es). If you click on it, it will automatically update itself
(it takes about two seconds), but that's still easier than firing up
the Terminal and typing
Feel free to improve upon this concept - the source is open for you to grab, it's very (like, very very) trivial to adapt it to other use cases.
- Let the .desktop file point to an icon in /home/user/
- The code can now update this icon using PIL
- The icon is automatically reloaded when it changes
This is very lightweight: When idle, this "widget" doesn't take up any more resources than a normal app icon would (it it just that, after all).
- Package: ipaddr-widget_1.0.0_all.deb
- Source package: ipaddr-widget_1.0.0.dsc and ipaddr-widget_1.0.0.tar.gz
- Git repository: https://github.com/harmattan/ipaddr-widget
This widget is proudly powered by Python and PIL. If you have problems
installing the .deb, please install the packages
python-imaging (both are in the Nokia Repos) using:
$ devel-su (enter the root password, usually "rootme") # apt-get update # apt-get install python python-imaging
If you are installing from the command line (with
you can use
apt-get -f install after it to fulfill missing
Further work / ideas
In addition to changing the icon itself, one could also change the
(if it's in
/home/user/.local/share/applications/, you can
read/write it easily from your code without permission problems) and
changing e.g. the text below the "widget" to something useful.
Combined with the Event Feed library, one could make even more flexible widgets.
Also, one could combine this image-generating technique with the fact that the N9 supports an operator logo (used by e.g. Frals' LPM Customizer) and come up with some fancy low power mode display "widget"...
postinst script could make sure that if the icon does
not exist, it will be created (make sure to chown it to user, though).
Right now, the user has to click the widget after install to load it.
And last but not least you don't have to have user interaction to update the widget - just let something run in the background and update the icon file and it will automatically be reloaded.