From 2deb9d010d890ec4682210c363ec340877f7bfcf Mon Sep 17 00:00:00 2001 From: Geoffrey Thomas Date: Sun, 1 Mar 2009 03:18:07 -0500 Subject: [PATCH] Use pynotify instead of shelling out to notify-send. Unfortunately now I'm leaking memory. This is probably easy to avoid... --- barn-growl/barn-growl.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 -- 2.44.0