NotifyThis 0.1: notify everything easily!

In our French ubuntu party organized by ubuntu-fr, we have approximately 20 free and ready to use computers for people to be able to try ubuntu on their own (we have someone around to help new users).

But that's a lot of wasted space for advertising our conferences, scheduled demonstrations, lessons we have during the party! So, the idea was to create a daemon notifying this, resulting in: example.png

notifythis192.png NotifyThis is here to fulfill this need. It's a desktop daemon (no pid file) using dbus for single instance and actions like pausing, stopping, forcing configuration file reload[1]

Source file is in XML (default in /etc/notifythis-data.xml):

 <?xml version="1.0" encoding="UTF-8"?>
 <notifythis xmlns='' xml:lang='fr'>
           <title>Beginners lesson</title>
           <content>Lesson for beginners in 10 min</content>
           <time>2009-09-27 12:33</time>
           <title>Advanced lesson</title>
           <content>Advanced lesson starting in 15 min</content>
           <time>2009-09-26 22:01</time>
           <title>Awesome conference</title>
           <content>An awesome conference on Ubuntu will start in 5 min.\nKeep it hot!</content>
           <time>2009-09-27 23:54</time>
           <title>End of the event</title>
           <content>Well… I guess you will have to leave NOW!</content>
           <time>2009-09-27 23:55</time>

What can I do in this notifythis namespace?

You associate an event instance (in notifevents/event ) to a notifytypes/type/name declared in the file. Types enables you to set some default priorities and icons to events. <Icon> refers to a path to an icon, which can be local to your computer or distant served by your preferred web server (http://…). In the latter case, NT will cache it for you locally. Consequently, using multiple times the same icon in different types or events will download it only once.

Title is used as… notification title and content as… content :) <time> is used to specify when the event will be notified. Categorizing your event is just a way to avoid multiple icon/priority definitions, but those two values can be overridden for a particular event simply specifying corresponding tag (<icon> for instance). If it can't be found, event type icon will be shown. If this one doesn't exist/can't be reachable either, a warning is spawn in log file and no icon will be displayed.

So, you can for your event, but it can be bound with any kind of other things like calendar, TODO items, and so on…

But well, as unscheduled event changes may happen[2], you surely want to upload your xml file online and reload it in all NotifyThis daemon dynamically. It's possible too (and what we will do during our party).

In /etc/notifythis, you can set where the xml file is:

 # time in minutes beteen two xml file reloading, default is 30 minutes
 # xml files (separated by ';') by order of preferences.
 # It can an absolute or a relative path to this file.
 # It can be a network path (http://) too

You can even specify multiple XML_FILES and first found one will be use (like in XML_FILES=http://my/central/xml/file.xml; /usr/local/mybackupfile1.xml;notifythis-data.xml). XML file will be reloaded every $DELTA_BETWEEN_XML_RELOAD min (30 min if not specified) in each daemon. If no xml file is found, previous working configuration is preserved and a retry is done every minutes then.

By default, NotifyThis is a desktop daemon[3] launched with a classical .desktop file in /etc/xdg/autostart/. Log are in ~/.local/share/notifythis/notifythis.log

Well, NT uses Quickly to simplify project handling. I guess we should investigate in a desktop-daemon template, making properly the double forking, using dbus instead of a pid file and dbus communication to reload configuration file, stop, pause… this can be handy! We can perhaps add a way for a template to reference another template to avoid redefining same commands twice and gives an easy way to call them (without having specifying --template ubuntu-project, for instance).

Well, if you want to give it a try, NotifyThis 0.1 is out and is available in my ppa.


[1] –help is your friend

[2] and will certainly happen actually

[3] you can launch it interactively as well, with –no-daemon and set different verbosity levels

Share Comments
comments powered by Disqus