Launch the application when clicking the lever notification

Using bash / shell scripts, I canโ€™t say when an unsuccessful login attempt occurred and a photo of someone sitting in front of the computer in a growl notification was displayed. Is there a way I can use growlnotify to launch a preview to display an image when I click on a notification?

+4
source share
2 answers

One thing you could do is pass the --url parameter to growlnotify .

Vaz example:

 ( # load some cat pics... I promise they are actually cat pics but # I don't promise they won't go link-dead since I linked to google image caches # or something. img1=/tmp/catpic1; curl -L bit.ly/16IRub3 > $img1 img2=/tmp/catpic2; curl -L bit.ly/XUCzHW > $img2 # schedule growls... replace this of course with whatever # actually sends your growls for i in $img1 $img2; do ( growlnotify -s -m "oh noes $i" --image $i --url "file://ABSOLUTE_PATH/$i" ) & sleep 4 done ) 

Note that I removed -w from the options, as well as the following open command. Since we use --url , growlnotify handles the callback on its own. You do not need to pause execution, and this method will probably solve the problem that Vaz exposed for several notifications. Passing the line file://... to --url , growlnotify opens the specified file in the system application by default after clicking on the notification.

Final result: --url will handle the URL correctly if you pass it a line starting with http:// . "google.com" or "www.google.com" will not work. The same goes for the structure of your file system, you should provide something like file:///Users/you/Pictures/cats.jpg .

This feature has been available since version 1.4, but from what I checked, it is missing in man .

Sources: https://code.google.com/p/growl/issues/detail?id=341 https://groups.google.com/d/msg/growldiscuss/nUdYxOevkxI/oYjxdhSEi98J

Hope this helps!

+3
source

Here is one way to do this:

 ( # load some cat pics... I promise they are actually cat pics but # I don't promise they won't go link-dead since I linked to google image caches # or something. img1=/tmp/catpic1; curl -L bit.ly/16IRub3 > $img1 img2=/tmp/catpic2; curl -L bit.ly/XUCzHW > $img2 # schedule growls... replace this of course with whatever # actually sends your growls for i in $img1 $img2; do ( growlnotify -ws -m "oh noes $i" --image $i ; open -a preview $i ) & sleep 4 done ) 

The main problem is that when several notifications appear, clicking one at a time will force everyone to block growlnotify subshells to unlock (by opening all photos at once). For some reason, this seems like standard behavior for growls. This may not be a problem, except that it does not behave as well as if it was standing in line correctly (I tried to do this with some recursive control over the operation of the subobject, but I donโ€™t think bash will let me do this do it ... there is, of course, a more attractive way to do this, in order to actually queue them.)

0
source

All Articles