daemon.js: remove superfluous semicolon
[conkeror.git] / modules / daemon.js
blob522a8c84d200dfaa6ad41bd5bfdcb05901dccd87
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 in_module(null);
11 require("mode.js");
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 "+
17     "the program.");
19 function daemon_quit_hook_fn () {
20     if (daemon_quit_exits)
21         daemon_mode(-1);
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);
30     },
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);
36     });
38 require_later("command-line.js");
40 call_after_load("command-line", function () {
41         command_line_handler("daemon", true, function () {
42                 daemon_mode(true);
43                 var window = make_chrome_window(conkeror_chrome_uri);
44                 window.setTimeout(function () { window.close(); }, 0);
45             });
46     });
48 provide("daemon");