Receive notifications from *another application*?

The Growl forums have moved to Google Groups, this forum is read only.
jameswfrost
Harmless
Posts: 1
Joined: Thu Jun 08, 2006 9:11 am

Receive notifications from *another application*?

Postby jameswfrost » Fri Nov 28, 2008 4:28 pm

Hi there,

I was wondering if there was any way to intercept Growl notifications? Or, to receive notifications posted by another application?
I have a music playing application that posts Growl notifications when the song changes - I'd like to be able to grab the titles and artists of the songs in the notifications, so I can do other things with them.

Is this at all possible?

User avatar
Diggory
Growl Team
Posts: 129
Joined: Sat Dec 04, 2004 12:17 pm
Location: London

Re: Receive notifications from *another application*?

Postby Diggory » Sat Nov 29, 2008 2:08 am

A bit of a hack - and probably not recommended - but you could use Notification Watcher to observe the pattern of Growl notifications in the NSDistributedNotification system.

Your code could then observe Growl notifications based on your criteria using the NSDistributedNotification Class.

Again - remember that this would be a hack and may not reliable or recommended.

originalpete
Harmless
Posts: 2
Joined: Thu Dec 11, 2008 8:13 pm

Re: Receive notifications from *another application*?

Postby originalpete » Thu Dec 11, 2008 8:28 pm

I'm also interested in this.

I'm trying to get the raw growl notifications out of Skype on OSX. Skype is set up with Growl, and I get the usual growl popups when people sign in/out and for all other Skype events.

As you suggested, I used the NotificationWatcher tool to monitor messages. But I only see NSConcreteNotifications if:
a) I click on a growl notification or,
b) the notification times out.

There are no notifications generated for the initial broadcast from Skype to Growl. Which means I'm trying to hook my notification monitor into the wrong place. This seems to indicate that applications don't talk _to_ growl using the NSNotificationCenter. Is this correct?

Please advise.

originalpete
Harmless
Posts: 2
Joined: Thu Dec 11, 2008 8:13 pm

Re: Receive notifications from *another application*?

Postby originalpete » Fri Dec 12, 2008 12:24 pm

Ok, I'm getting closer:

Turns out that if Growl is running, I don't see the notifications in NotificationWatcher. I wrote my own simple watcher using MacRuby with the new on_notification mapping from HotCocoa, and witnessed similar behaviour.

When Growl is running it swallows up the notification and I can't see it. When growl is off, the GrowlNotifications from Skype are processed by my watcher script.

So, how can I get both? It must be possible to attach my observers to NSDistributedNotificationCenter.defaultCenter in such a way that it can see notifications that are being observed by Growl. Any ideas how?

P.

User avatar
The_Tick
Cocoaforge Admin
Posts: 4642
Joined: Thu Dec 02, 2004 6:06 am
Contact:

Re: Receive notifications from *another application*?

Postby The_Tick » Fri Dec 12, 2008 4:09 pm

Growl doesn't use notification center except as a backup communication method anymore. I think this is the wrong tree.

We added code a long time back to allow for a dashboard widget to get notifications from Growl. If that's still in place, you could go that route.


Return to “Growl”

Who is online

Users browsing this forum: No registered users