Ekg2 tips

From awesome
Jump to: navigation, search

Naughty notifications

There is a simple python script for ekg2, that uses Naughty to notify user about incoming messages:

import dbus
import ekg

def message_handler(session, uid, type, text, sent_time, ignore_level):
    no = dbus.SessionBus().get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
    ni = dbus.Interface(no, 'org.freedesktop.Notifications')
    ni.Notify("python", 0, , uid[:40], text[:40], {}, {}, 5000)

    return 1

ekg.handler_bind('protocol-message-received', message_handler)

Running script

Make sure that python plugin is loaded in ekg2. To enable notifications just type:

/script:load /path/to/script.py

Refer ekg2 documentation for more details.

It works with new svn versions of ekg2 (2009-01-14). It does not work with last release (0.1.1). It seems that python support is broken in that release.

Personal tools