2 * (C) Copyright 2007 John J. Foerch
3 * (C) Copyright 2007-2008 Jeremy Maitin-Shepard
5 * Use, modification, and distribution are subject to the terms specified in the
12 * This mode gets loaded into application scope.
17 var daemon_quit_exits
= true;
19 function daemon_quit_exits_p () {
20 return daemon_quit_exits
;
23 function daemon_quit_hook_fn () {
24 if (daemon_quit_exits_p ())
28 define_global_mode("daemon_mode",
29 function () { // enable
30 var appStartup
= Components
.classes
["@mozilla.org/toolkit/app-startup;1"]
31 .getService(Components
.interfaces
.nsIAppStartup
);
32 appStartup
.enterLastWindowClosingSurvivalArea();
33 add_hook("quit_hook", daemon_quit_hook_fn
);
35 function () { // disable
36 var appStartup
= Cc
["@mozilla.org/toolkit/app-startup;1"]
37 .getService(Ci
.nsIAppStartup
);
38 appStartup
.exitLastWindowClosingSurvivalArea ();
39 remove_hook("quit_hook", daemon_quit_hook_fn
);
42 require_later("command-line.js");
44 call_after_load("command-line.js", function () {
45 command_line_handler("daemon", true, function () {
47 var window
= make_chrome_window(conkeror_chrome_URI
);
48 window
.setTimeout(function() { window
.close(); }, 0);