-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmwm.cpp
49 lines (41 loc) · 1.08 KB
/
mwm.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "Manager.hpp"
#include <getopt.h>
int main(int argc, char* argv[])
{
static struct option long_options[] =
{
{"display", required_argument, NULL, 'd'},
{"screen", required_argument, NULL, 's'},
{"screenshot-dir", required_argument, NULL, 'S'},
{NULL, 0, NULL, 0}
};
std::string display;
std::map<int,Point> screens;
std::string screenshotDir = "${HOME}";
int ch;
while ((ch = getopt_long(argc, argv, "d:s:S:", long_options, NULL)) != -1) {
switch (ch) {
case 'd':
display = optarg;
break;
case 's': {
int screen;
int x = 0, y = 0;
if (sscanf(optarg, "%i(%i,%i)", &screen, &x, &y) < 1)
throw std::invalid_argument("invalid screen argument");
screens[screen] = Point(x,y);
break;
}
case 'S':
screenshotDir = optarg;
break;
}
}
std::map<std::string,MonitorCfg> monitorCfg;
LOG(INFO) << "starting mwm";
Manager m(display, screens, screenshotDir, monitorCfg);
if (!m.init())
return EXIT_FAILURE;
m.run();
return EXIT_SUCCESS;
}