aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main.cpp
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-12-07 18:51:18 +0100
committerGitHub <[email protected]>2024-12-07 18:51:18 +0100
commit8bbeee11734d3ba8e2cf15d19cb3c302f8bfdbf2 (patch)
tree5b6654818049a0743f62defc090e86d4327cccbb /src/main.cpp
parentb1e5cc66bdb20b002c93479490c3a317552210b3 (diff)
downloadHyprland-8bbeee11734d3ba8e2cf15d19cb3c302f8bfdbf2.tar.gz
Hyprland-8bbeee11734d3ba8e2cf15d19cb3c302f8bfdbf2.zip
core: Add clang-tidy (#8664)
This adds a .clang-tidy file for us. It's not a strict requirement to be compliant, but I tuned it to be alright.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 6bbf73fd..6b6f9063 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -54,11 +54,11 @@ int main(int argc, char** argv) {
std::vector<std::string> args{argv + 1, argv + argc};
for (auto it = args.begin(); it != args.end(); it++) {
- if (it->compare("--i-am-really-stupid") == 0 && !ignoreSudo) {
+ if (*it == "--i-am-really-stupid" && !ignoreSudo) {
std::println("[ WARNING ] Running Hyprland with superuser privileges might damage your system");
ignoreSudo = true;
- } else if (it->compare("--socket") == 0) {
+ } else if (*it == "--socket") {
if (std::next(it) == args.end()) {
help();
@@ -67,7 +67,7 @@ int main(int argc, char** argv) {
socketName = *std::next(it);
it++;
- } else if (it->compare("--wayland-fd") == 0) {
+ } else if (*it == "--wayland-fd") {
if (std::next(it) == args.end()) {
help();
@@ -75,7 +75,7 @@ int main(int argc, char** argv) {
}
try {
- socketFd = std::stoi(std::next(it)->c_str());
+ socketFd = std::stoi(*std::next(it));
// check if socketFd is a valid file descriptor
if (fcntl(socketFd, F_GETFD) == -1)
@@ -88,13 +88,13 @@ int main(int argc, char** argv) {
}
it++;
- } else if (it->compare("-c") == 0 || it->compare("--config") == 0) {
+ } else if (*it == "-c" || *it == "--config") {
if (std::next(it) == args.end()) {
help();
return 1;
}
- configPath = std::next(it)->c_str();
+ configPath = *std::next(it);
try {
configPath = std::filesystem::canonical(configPath);
@@ -114,31 +114,31 @@ int main(int argc, char** argv) {
it++;
continue;
- } else if (it->compare("-h") == 0 || it->compare("--help") == 0) {
+ } else if (*it == "-h" || *it == "--help") {
help();
return 0;
- } else if (it->compare("-v") == 0 || it->compare("--version") == 0) {
+ } else if (*it == "-v" || *it == "--version") {
std::println("{}", versionRequest(eHyprCtlOutputFormat::FORMAT_NORMAL, ""));
return 0;
- } else if (it->compare("--systeminfo") == 0) {
+ } else if (*it == "--systeminfo") {
std::println("{}", systemInfoRequest(eHyprCtlOutputFormat::FORMAT_NORMAL, ""));
return 0;
} else {
- std::println(stderr, "[ ERROR ] Unknown option '{}' !", it->c_str());
+ std::println(stderr, "[ ERROR ] Unknown option '{}' !", *it);
help();
return 1;
}
}
- if (!ignoreSudo && Init::isSudo()) {
+ if (!ignoreSudo && NInit::isSudo()) {
std::println(stderr,
"[ ERROR ] Hyprland was launched with superuser privileges, but the privileges check is not omitted.\n"
" Hint: Use the --i-am-really-stupid flag to omit that check.");
return 1;
- } else if (ignoreSudo && Init::isSudo()) {
+ } else if (ignoreSudo && NInit::isSudo()) {
std::println("Superuser privileges check is omitted. I hope you know what you're doing.");
}
@@ -165,7 +165,7 @@ int main(int argc, char** argv) {
g_pCompositor->initServer(socketName, socketFd);
if (!envEnabled("HYPRLAND_NO_RT"))
- Init::gainRealTime();
+ NInit::gainRealTime();
Debug::log(LOG, "Hyprland init finished.");