mirror of
https://github.com/hyprwm/hypridle.git
synced 2026-05-21 20:38:10 +02:00
It is already included because of ConfigManager.hpp, but that should not be relied on as logging is also directly used in the main function.
38 lines
997 B
C++
38 lines
997 B
C++
|
|
#include "config/ConfigManager.hpp"
|
|
#include "core/Hypridle.hpp"
|
|
#include "helpers/Log.hpp"
|
|
|
|
int main(int argc, char** argv, char** envp) {
|
|
std::string configPath;
|
|
|
|
for (int i = 1; i < argc; ++i) {
|
|
std::string arg = argv[i];
|
|
|
|
if (arg == "--verbose" || arg == "-v")
|
|
Debug::verbose = true;
|
|
|
|
else if (arg == "--quiet" || arg == "-q")
|
|
Debug::quiet = true;
|
|
|
|
else if (arg == "--config" || arg == "-c") {
|
|
configPath = argv[++i];
|
|
}
|
|
}
|
|
|
|
try {
|
|
g_pConfigManager = std::make_unique<CConfigManager>(configPath);
|
|
g_pConfigManager->init();
|
|
} catch (const char* err) {
|
|
Debug::log(CRIT, "ConfigManager threw: {}", err);
|
|
std::string strerr = err;
|
|
if (strerr.contains("File does not exist"))
|
|
Debug::log(NONE, " Make sure you have a config.");
|
|
return 1;
|
|
}
|
|
|
|
g_pHypridle = std::make_unique<CHypridle>();
|
|
g_pHypridle->run();
|
|
|
|
return 0;
|
|
}
|