summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorDarksome <dev@darkso.me>2022-07-15 19:42:03 +0300
committerDarksome <dev@darkso.me>2022-07-15 19:42:03 +0300
commit5388b54442614cb0d3d445f101e7cd86bf64c125 (patch)
tree26057ff185e423e944e8b250ed7fe26654b69623 /src/main.cpp
parentcb8a6f881b11e9a269fd5f7aa64eafe2beda0b0d (diff)
parent6306d4dae3fa221a6099e109c7faef60bac4fac5 (diff)
Merge upstream
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a437430f..9367d870 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -12,12 +12,22 @@ bool ignoreSudo = false;
int main(int argc, char** argv) {
if (!getenv("XDG_RUNTIME_DIR"))
- RIP("XDG_RUNTIME_DIR not set!");
+ throw std::runtime_error("XDG_RUNTIME_DIR is not set!");
// parse some args
+ std::string configPath;
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "--i-am-really-stupid"))
ignoreSudo = true;
+ else if ((!strcmp(argv[i], "-c") || !strcmp(argv[i], "--config")) && argc >= i + 2) {
+ configPath = std::string(argv[++i]);
+ Debug::log(LOG, "Using config location %s.", configPath.c_str());
+ } else {
+ std::cout << "Hyprland usage: Hyprland [arg [...]].\n\nArguments:\n" <<
+ "--help -h | Show this help message\n" <<
+ "--config -c | Specify config file to use\n";
+ return 1;
+ }
}
system("mkdir -p /tmp/hypr");
@@ -37,6 +47,7 @@ int main(int argc, char** argv) {
// let's init the compositor.
// it initializes basic Wayland stuff in the constructor.
g_pCompositor = std::make_unique<CCompositor>();
+ g_pCompositor->explicitConfigPath = configPath;
Debug::log(LOG, "Hyprland init finished.");
@@ -46,7 +57,7 @@ int main(int argc, char** argv) {
// If we are here it means we got yote.
Debug::log(LOG, "Hyprland reached the end.");
- g_pCompositor->cleanupExit();
+ g_pCompositor->cleanup();
return EXIT_SUCCESS;
}