Skip to content
Browse files

Added support for libnotify (but it requires libnotify-bin to be inst…

…alled; which might not be installed by default on some systems).
  • Loading branch information...
1 parent 7e064e7 commit 9923c7707e0a8c3f79ae012c4938b64eab7282e2 @abi committed Jul 26, 2009
Showing with 26 additions and 2 deletions.
  1. +1 −1 README
  2. +25 −1 components/yip.js
View
2 README
@@ -1 +1 @@
-Yip is a Firefox extension that ports the Fluid and Prism notification APIs over to Firefox so you can receive Growl notifications (or plain Firefox notifications if you're on Windows or Linux) from web applications. For more information, head over to http://abcdefu.wordpress.com
+Yip is a Firefox extension that ports the Fluid and Prism notification APIs over to Firefox so you can receive Growl notifications (or plain Firefox notifications if you're on Windows or Linux) from web applications. For more information, head over to http://www.yipyip.com
View
26 components/yip.js
@@ -47,7 +47,13 @@ Yip.prototype = {
var osString = Cc["@mozilla.org/xre/app-info;1"]
.getService(Ci.nsIXULRuntime).OS;
var msgSent = false;
-
+ var id = "yip@foyrek.com";
+ var extension = Cc["@mozilla.org/extensions/manager;1"]
+ .getService(Ci.nsIExtensionManager)
+ .getInstallLocation(id)
+ .getItemLocation(id);
+ var iconPath = "";
+
if(osString == "WINNT"){
// open the interface to Snarl
const cid = "@tlhan-ghun.de/snarlInterface;5";
@@ -67,6 +73,24 @@ Yip.prototype = {
}
}else if(osString == "Linux"){
//Use libnotify
+ iconPath = extension.path + "/content/images/icon.png";
+ try {
+
+ var file = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsILocalFile);
+ file.initWithPath("/usr/bin/notify-send");
+
+ var process = Components.classes["@mozilla.org/process/util;1"]
+ .createInstance(Components.interfaces.nsIProcess);
+ process.init(file);
+ var args = [utf8.encode(title), utf8.encode(text), "-i", iconPath];
+ process.run(false, args, args.length);
+ msgSent = true;
+
+ }catch(e){
+ msgSent = false;
+ }
+
}
if(!msgSent){

0 comments on commit 9923c77

Please sign in to comment.
Something went wrong with that request. Please try again.