2 * (C) Copyright 2007-2009 John J. Foerch
3 * (C) Copyright 2007-2008 Jeremy Maitin-Shepard
5 * Use, modification, and distribution are subject to the terms specified in the
13 define_variable("daemon_quit_exits", true,
14 "This variable controls whether the `quit' command will exit "+
15 "the program or only close windows when daemon-mode is enabled. "+
16 "The default is true, meaning that the `quit' command will exit "+
19 function daemon_quit_hook_fn () {
20 if (daemon_quit_exits)
24 define_global_mode("daemon_mode",
25 function () { // enable
26 Cc["@mozilla.org/toolkit/app-startup;1"]
27 .getService(Ci.nsIAppStartup)
28 .enterLastWindowClosingSurvivalArea();
29 add_hook("quit_hook", daemon_quit_hook_fn);
31 function () { // disable
32 Cc["@mozilla.org/toolkit/app-startup;1"]
33 .getService(Ci.nsIAppStartup)
34 .exitLastWindowClosingSurvivalArea();
35 remove_hook("quit_hook", daemon_quit_hook_fn);
38 require_later("command-line.js");
40 call_after_load("command-line", function () {
41 command_line_handler("daemon", true, function () {
43 var window = make_chrome_window(conkeror_chrome_uri);
44 window.setTimeout(function () { window.close(); }, 0);