isearch-backspace, isearch-done: docstrings
[conkeror.git] / modules / daemon.js
blobf628a6de287d8c0302a237c3b93417524c725b0b
1 /**
2  * (C) Copyright 2007-2009 John J. Foerch
3  * (C) Copyright 2007-2008 Jeremy Maitin-Shepard
4  *
5  * Use, modification, and distribution are subject to the terms specified in the
6  * COPYING file.
7 **/
9 require("mode.js");
11 define_variable("daemon_quit_exits", true,
12     "This variable controls whether the `quit' command will exit "+
13     "the program or only close windows when daemon-mode is enabled. "+
14     "The default is true, meaning that the `quit' command will exit "+
15     "the program.");
17 function daemon_quit_hook_fn () {
18     if (daemon_quit_exits)
19         daemon_mode(-1);
22 define_global_mode("daemon_mode",
23     function () { // enable
24         Cc["@mozilla.org/toolkit/app-startup;1"]
25             .getService(Ci.nsIAppStartup)
26             .enterLastWindowClosingSurvivalArea();
27         add_hook("quit_hook", daemon_quit_hook_fn);
28     },
29     function () { // disable
30         Cc["@mozilla.org/toolkit/app-startup;1"]
31             .getService(Ci.nsIAppStartup)
32             .exitLastWindowClosingSurvivalArea();
33         remove_hook("quit_hook", daemon_quit_hook_fn);
34     });
36 require_later("command-line.js");
38 call_after_load("command-line", function () {
39         command_line_handler("daemon", true, function () {
40                 daemon_mode(true);
41                 var window = make_chrome_window(conkeror_chrome_uri);
42                 window.setTimeout(function () { window.close(); }, 0);
43             });
44     });
46 provide("daemon");