Permalink
Browse files

experimental command-line handling

will be useful to have a command for toggling windows that can be linked to the
wm keyboard shortcut mapping.

TODO: find out why helpInfo not working
  • Loading branch information...
1 parent 746ab75 commit 13f9b31ed933785ea54ef497e25f5f394483827c @foudfou committed Mar 30, 2012
Showing with 44 additions and 0 deletions.
  1. +4 −0 src/chrome.manifest
  2. +40 −0 src/components/firetray-clhandler.js
View
@@ -9,3 +9,7 @@ overlay chrome://songbird/content/xul/mainScriptsOverlay.xul chrome://firetray/c
overlay chrome://sunbird/content/calendar.xul chrome://firetray/content/overlay.xul
overlay chrome://navigator/content/navigator.xul chrome://firetray/content/overlay.xul
overlay chrome://chatzilla/content/chatzilla.xul chrome://firetray/content/overlay.xul
+
+component {a9c9cc52-4d6c-45c2-a73f-0be1bd60aaa6} components/firetray-clhandler.js
+contract @mozilla.org/commandlinehandler/general-startup;1?type=firetray {a9c9cc52-4d6c-45c2-a73f-0be1bd60aaa6}
+category command-line-handler m-firetray @mozilla.org/commandlinehandler/general-startup;1?type=firetray
@@ -0,0 +1,40 @@
+// https://developer.mozilla.org/en/Chrome/Command_Line
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://firetray/logging.jsm");
+
+function firetayCommandLineHandler() {}
+firetayCommandLineHandler.prototype = {
+ classDescription: "firetayCommandLineHandler",
+ classID: Components.ID('{a9c9cc52-4d6c-45c2-a73f-0be1bd60aaa6}'),
+ contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=firetray",
+ _xpcom_categories: [{
+ category: "command-line-handler",
+ entry: "m-firetray"
+ }],
+
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.nsICommandLineHandler
+ ]),
+
+ /* nsICommandLineHandler */
+ handle: function clh_handle(cmdLine)
+ {
+ if (cmdLine.handleFlag("firetray", false)) {
+ firetray.WARN("*** CALL ***");
+ cmdLine.preventDefault = true;
+ }
+ },
+
+ // NOTE: change the help info as appropriate, but follow the guidelines in
+ // nsICommandLineHandler.idl specifically, flag descriptions should start at
+ // character 24, and lines should be wrapped at 72 characters with embedded
+ // newlines, and finally, the string should end with a newline
+ helpInfo: " -firetray FOUDIL WAS HERE\n"
+};
+
+var NSGetFactory = XPCOMUtils.generateNSGetFactory([firetayCommandLineHandler]);

0 comments on commit 13f9b31

Please sign in to comment.