summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/main.cc b/src/main.cc
index 4bcbdd3..096b0f3 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -8,8 +8,9 @@
#include "animator.hh"
#include "args.hh"
-#include "io.hh"
+#include "goma.hh"
#include "icecc.hh"
+#include "io.hh"
#include "monmon.hh"
#include "poll_looper.hh"
#include "x.hh"
@@ -142,31 +143,37 @@ void xcb_event_loop(x::shared_connection const& conn,
int main(int argc, char** argv) {
std::unique_ptr<Args> args(Args::create());
- args->add("network", "NETNAME",
- "monitor NETNAME instead of default ICECREAM");
- args->add("scheduler", "HOST",
- "connect to scheduler at HOST instead of broadcasting");
args->add("display", "HOST:VS", "connect to X server at [HOST]:[VS]");
args->add("no-render", "do not use render extension even if available");
args->add("titlebar", "create a normal window instead of the default without"
" titlebar (or other WM addons)");
args->add("black", "use black background instead of background pixmap");
- args->add("columns", "COLUMNS", "force columns to be COLUMNS instead of"
- " calculated from window size");
args->add("help", "display this text and exit.");
+ args->add("network", "NETNAME",
+ "monitor NETNAME instead of default ICECREAM (icecc only)");
+ args->add("scheduler", "HOST",
+ "connect to scheduler at HOST instead of broadcasting"
+ " (icecc only)");
+ args->add("columns", "COLUMNS", "force columns to be COLUMNS instead of"
+ " calculated from window size (icecc only)");
+ args->add("goma", "start GOMA monitor instead of icecc");
+ args->add("goma_addr", "ADDR",
+ "address to connect to instead of default"
+ " http://localhost:8088 (goma only)");
if (!args->run(argc, argv)) {
std::cout << "Try `monmon --help` for usage." << std::endl;
return EXIT_FAILURE;
}
if (args->is_set("help")) {
std::cout << "Usage: `monmon [OPTIONS...]`\n"
- << "icecream (icecc) monitor\n"
+ << "icecream (icecc) or goma monitor\n"
<< "\n";
args->print_help(std::cout);
return EXIT_FAILURE;
}
+ bool goma = args->is_set("goma");
unsigned columns = 0;
- {
+ if (!goma) {
auto tmp = args->arg("columns", nullptr);
if (tmp) {
char* end = nullptr;
@@ -200,7 +207,12 @@ int main(int argc, char** argv) {
atoms->preload("__MONMON_QUIT");
MonMon::preload(atoms.get());
std::shared_ptr<x::Ewmh> ewmh(x::Ewmh::create(conn, screen_index));
- std::shared_ptr<MonMon> monmon(create_icecc_monmon(looper, columns));
+ std::shared_ptr<MonMon> monmon;
+ if (goma) {
+ monmon = create_goma_monmon(looper);
+ } else {
+ monmon = create_icecc_monmon(looper, columns);
+ }
monmon->init(conn, screen, format, atoms, ewmh, 400, 400,
args->is_set("titlebar"), args->is_set("black"));
if (!monmon->connect(args.get()))