-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
38 lines (33 loc) · 1.21 KB
/
main.cpp
File metadata and controls
38 lines (33 loc) · 1.21 KB
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
#include <cstdlib>
#include <iostream>
#include "wm.h"
const std::string VERSION = "v0.7";
void argParse(int argc, char** argv, std::string &configPath) {
if (argc == 2 && argv[1] == "-v") {
SomeLogger::Logger::Instance().log(SomeLogger::LoggerLevel::INFO) << "UNKNOWN Version: " << VERSION << "\n";
exit(0);
} else if (argc == 2 && argv[1] == "-h") {
SomeLogger::Logger::Instance().log(SomeLogger::LoggerLevel::INFO) << "Version: " << VERSION << "\n";
} else if (argc == 3 && argv[1] == "-c") {
configPath = argv[2];
} else if (argc != 1) {
SomeLogger::Logger::Instance().log(SomeLogger::LoggerLevel::ERR) << "Wrong key\n";
exit(-1);
}
}
std::string configPath = "/home/daniil/Documents/unknowwm/config";
int main(int argc, char** argv) {
argParse(argc, argv, configPath);
auto config = std::make_unique<UW::Config>(configPath);
std::unique_ptr<UW::WindowManager> windowManager(UW::WindowManager::Create());
if (!windowManager) {
SomeLogger::Logger::Instance().log(SomeLogger::LoggerLevel::ERR) << "Can not open display\n";
return -1;
}
windowManager->config = std::move(config);
windowManager->init();
windowManager->desktopInfo();
windowManager->run();
windowManager->cleanup();
return 0;
}