X-Git-Url: https://snippets.scripts.mit.edu/gitweb.cgi/Scripts/git/.git/blobdiff_plain/c05571125300359c288ba0d37a2c62c555ab4180..2deb9d010d890ec4682210c363ec340877f7bfcf:/barn-growl/barn-growl.py diff --git a/barn-growl/barn-growl.py b/barn-growl/barn-growl.py index 6a4a7cb..546cd69 100755 --- a/barn-growl/barn-growl.py +++ b/barn-growl/barn-growl.py @@ -17,6 +17,10 @@ class Notifier(AbstractConsumer): def __init__(self, usegrowl, usenotify, useprint): self.usegrowl = usegrowl self.usenotify = usenotify + if usenotify: + import pynotify + pynotify.init("Zephyr") + self.pings = {} self.useprint = useprint return def feed(self, s): @@ -48,8 +52,11 @@ class Notifier(AbstractConsumer): g.stdin.write(message) g.stdin.close() if self.usenotify: - notifysend = ['notify-send', header, message] - subprocess.call(notifysend) + import pynotify + if id in self.pings: + self.pings[id].close() + self.pings[id] = pynotify.Notification(header, message) + self.pings[id].show() def close(self): return