watch this  

the official mrchucho blog

Firefox and Growl

Posted 2004 Dec 27

I was able to hack minimal Growl support onto Firefox. I can’t stand the default Firefox download manager and I thought Growl is the perfect way to inform me that a downloaded has completed. So, I cobbled together a little plugin.

Unfortunately, I had to write a little shell script to take the message (in this case, the name of the file being downloaded) as an argument, since growlnotify reads from STDIN. Even more unfortunately, there seems to be a bug in nsIProcess - the way Firefox launches external applications - which causes it to throw an Exception when you send arguments to a process… So, I had to write the message to a file that is then cat’d to growlnotify via a shell script:
cat ~/Documents/growl.txt | /usr/bin/growlnotify "Download Complete" 
See? Told you it was a hack. To make this actually work, needs to be fixed and I need a better way to actually interface with growl (besides a shell-script to growlnotify…) Perhaps a javascript binding?

Growl Firefox plugin

Responses to "Firefox and Growl"


2005 Jan 11 at 22:56

Well, I’m the lead Developer for growl and I think this is a great idea, I already have Growl support for Safari and Shira and hear rumors of Omniweb support so this will round out the Growl goodness. Since I believe the xpi api is C, you should be able to include the CoreFoundation headers to build a plugin that only works on the mac, but can use the Growl Carbon headers directly.

If your not up for some C action, you can use Perl, or even Java to get at Growl. The class encapsulates all the work of talking to Growl so you just have to write a few lines. Only problem with that is it would mean the Java Runtime for FireFox would be always loaded, and that might not be the best for performance.

Last but not least there is good ole AppleScript. You could perhaps write an applescript that takes a specially formatted version of the info, parses it then notifies with growl. Something like “New Porn Site Found:|:Porn site lives at|: And with that you’ve gotten all teh info that’s useful, and made a pretty dumb simple seperator out of:”

P.S. I liked your version of Kubrick so much, I decided to gank most of it. :-)

Nikolas Coukouma

2006 Feb 18 at 12:53

Yeah, nsIProcess does really old stuff under OS X. It’s on my list of thing I’d like to fix … For Greasemonkey, I had to abuse nsIMimeInfo to make the “edit script” button work. I don’t think that trick will work here since you want to pass a string, not a filename.

EnigMail includes a nice IPC module that will do what you want. See the ipc directory, specifically nsIPipeChannel.init . It would eliminate the obvious race condition problem, but you’d have to compile the binary for your extension …

Comments are now closed.
atom rss