March 9, 2009

Playing with D-BUS service autostart

Offtopic: a small undocumented issue in edelib about registering unique D-BUS name was fixed in the repo. I'm not sure how I missed this; probably I was thinking that native dbus_bus_request_name() will do all the work, but it turns out that it is much more powerfull than simply name request. Check out D-BUS docs about it (read that part few times, they complicated a little bit with explaination ;)).

D-BUS service autostart (I'm using word "autostart", but docs are saying "start"; feels much more natural) is one very cool D-BUS feature (probably inspired with CORBA), where D-BUS would start a service provider on demand. E.g. you have org.example.Test service implemented in test-daemon, but you don't want to run in in the background all the time, only when is really needed. As D-BUS specs prescribes, you simply create an .desktop like file, ends it with .service (preferring way is to use service-like name, e.g. org.example.Test.service) and put in D-BUS service directory. Now, when you first time conntact this service, test-daemon would be spawned and apps would happily starts to consume org.example.Test.

So, following this, I added Startup Notification support in ede-launch-sn, a small helper tool for ede-launch command I quickly constructed just for this; ede-launch would connect on org.equinoxproject.StartupNotify and call StartupNotify member, initiating notification sequence. Then ede-launch-sn would terminate that sequence after some timeout.

Startup Notification listener is not implemented yet, so notification is only seen in window managers (or environments) that has support for it.

I didn't put the code on the repo because I still didn't figure out should we need another service in the background and/or how could it be nicely blended in ede-launch command.
Tags: EDE