14 Jan 2009 ted   » (Journeyer)

Bazaar Power Management

When I saw Robert's interesting and fun Bazaar search plug-in I had a few thoughts:

Wow, that's cool!
It would sure be awesome if I could say that I've written as many Bazaar plugins as Robert this month.
That sounds like work.
Perhaps I can do this with, like, 6 lines of Python.

I've now written a plug-in to provide desktop power management support to Bazaar. You can install it like this:

mkdir -p ~/.bazaar/plugins
bzr branch lp:~ted-gould/+junk/bazaar-power-management ~/.bazaar/plugins/power_management

This hack-ish plug-in uses the initialization of the plug-in to call the DBus interface for power management to inhibit the power manager. It then relies on the fact that the power manager will drop an inhibit request from a client that disconnects from the bus which happens when the process exits. Both are relatively unsupported, and mostly undocumented ways to use the systems, but it works.

Why would you need something like this? Well if your trying to create a repository from a really slow SVN server which takes longer than the sleep timeout of your laptop (not that I've done this) you can end up really wishing your laptop hadn't gone to sleep. Yes, things restart, and you don't loose everything, but you'd really rather your laptop was awake the whole time. With this plug-in your laptop won't go to sleep while Bazaar is running.

The only thing left to consider is: What is Robert going to do to retaliate? 7 lines of Python?

Syndicated 2008-07-04 05:26:00 from TedBlog

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!