4

How do you execute a shell script whenever a Growl notification is shown? And make it application specific. For instance, run a the shell script say "You have new mail" whenever a growlMail notification is shown?

Ignacio Vazquez-Abrams
  • 111,361
  • 10
  • 201
  • 247
Wuffers
  • 19,020
  • 17
  • 95
  • 126

2 Answers2

3

To play a custom sound in response to a Growl notification:

  • Create a sound file and make it available to the system:

    say -o YouHaveMail "You have Mail"

    creates the sound file, "YouHaveMail.aiff". Sudo cp the file to /System/Library/Sounds/.

  • Configure Growl to use that sound for the particular app and notification:

    Growl preference pane | Applications
    In the Application list, select your application.

    Configure | Notifications
    In the Notifications: dropdown, select a notification.
    In the Play Sound: dropdown, select YouHaveMail.

JRobert
  • 6,744
  • 24
  • 28
  • I could just `cd` into the /System/Library/Sounds/ Folder and then run the command, right? – Wuffers May 03 '10 at 12:26
  • Yes, though you'll still need to sudo the command to get permission to write in there (assuming you're not root). – JRobert May 03 '10 at 13:43
0

I know you can forward growl notifications to other computers. Perhaps you could forward them to a port on localhost. If you had something listening to that port it could do something every time the notification was forwarded on that port. maybe..?

stib
  • 4,269
  • 6
  • 27
  • 38
  • I don't think it's possible to forward to localhost. Thanks for the answer though! – Wuffers Apr 29 '10 at 22:40
  • what about forwarding it to the ip address of the computer? Just grasping at straws here. – stib May 01 '10 at 11:28
  • You can't add forwarding on the computer you are forwarding from. You have to set it up on the computer that you are forwarding to. So it isn't possible. Thanks though! – Wuffers May 02 '10 at 12:25