Version User Scope of changes
Jul 23 2007, 9:36 PM EDT (current) pavpanchekha 128 words added, 85 words deleted
Feb 25 2007, 9:48 AM EST njpatel 311 words added

Changes

Key:  Additions   Deletions
IThis thoughtis i'dintended putfor somedevelopers ofhoping theto stuffcreate mentionedplugins onfor myAWN. blogPlease here,feel asfree anto exampleadd forhelpful makinghints pluginsto :other developers! However, developers are expected to have a firm grasp of DBus before beginning.

Writing Plugins through DBus:

If you want to write a plugin for your favouritefavorite app,applications, heresyou'll somefirst infoneed thatto you'llconnect need,to theAWN's codeDBus isobject. inIn Python, but should be easythat towould adoptlook forlike otherthe languages.
following:
bus = dbus.SessionBus()
obj = bus.get_object("com.google.code.Awn", "/com/google/code/Awn")
awn = dbus.Interface(obj, "com.google.code.Awn")


GetsWhich will get you the basic awnAWN object.object, which you will use to control various properties, such as an application's icon.

Getting to an application:

There are two main ways to get atthe yourapplication, task,orwindow, that you want:
  1. By theThe name of the application (string).(as a string).
    This works best for single-instance applications.
  2. By the xid (long),(as a long), which is best for multi-instance apps , as it will only effect the icon for that window.
    One way to get the xid is by calling GDK_WINDOW_XID(window->window).
  3. I am adding support

Support for using the pidPID to reference your application.application is planned.

Setting Icons

To set the icon for a task, you need to call either SetTaskIconByName or SetTaskIconByXid. In python,Python, itthat would be :
be:
awn.SetTaskIconByName ("rhythmbox", "/tmp/rhythmbox-album-art.png")

or

awn.SetTaskIconByXid (long(xid), "/tmp/rhythmbox-album-art.png")

Yes, theThe second argument of either has to be a /local/path/to/the/image/file.local path. Using /tmp is the best idea, as it will get wiped when you restart.
You have to call awn.SetTaskIconByName/Xid every time you want to update, even if you are using the same file name (recommended as to avoid unneccessary junk in /tmp).
If you need to unset the icon, use :

awn.UnsetTaskIconByName ("rhythmbox")

or

awn.UnsetTaskIconByXid (xid)

The name may not always match, Ihowever, amthough workingNeil onis this,working soon bethis;be patient if your favfavorite appapplication does not work :).work.

Setting Information
Information:

Setting information is easy:
awn.SetInfoByName ("evolution", "23")

or

awn.SetInfoByXid (xid, "23")

UnsetAnd so using:is unsetting:
awn.UnsetInfoByName ("evolution")

or

awn.UnsetInfoByXid (xid)

Setting Progress
ThisProgress:

This, too, is very easy:
awn.SetProgressByName ("firefox", 60)

or

awn.SetProgressByXid (xid, 60)

ThereWhile there is no 'unset' function, justsetting set the progress to 100100% towill clear the icon of the progress meter.

DBus links