Thursday, October 28, 2010

notify-me

I find this script (notify-me) most useful when I build webkit :-)

Just 'make && notify-me'. You will get a tray notification when the build is complete. Code is not mine, it's ripped from some site.

#!/usr/bin/env python
"""This is a python 2.5 script that creates a notification using dbus."""
import dbus
item = ('org.freedesktop.Notifications')
path = ('/org/freedesktop/Notifications')
interface = ('org.freedesktop.Notifications')

icon = ''
array = ''
hint = ''
time = 10000 # Use seconds x 1000
app_name = ('Test Application')
title = ('Whatever it is, is done')
body = ('Its all over.')

bus = dbus.SessionBus()
notif = bus.get_object(item, path)
notify = dbus.Interface(notif, interface)
notify.Notify(app_name, 0, icon, title, body, array, hint, time)

10 comments: