mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-14 11:35:46 -07:00
internal: improve version query and define HYPRLAND_VERSION (#8034)
This commit is contained in:
34
src/main.cpp
34
src/main.cpp
@@ -23,6 +23,7 @@ void help() {
|
||||
std::cout << " --config FILE -c FILE - Specify config file to use\n";
|
||||
std::cout << " --socket NAME - Sets the Wayland socket name (for Wayland socket handover)\n";
|
||||
std::cout << " --wayland-fd FD - Sets the Wayland socket fd (for Wayland socket handover)\n";
|
||||
std::cout << " --systeminfo - Prints system infos\n";
|
||||
std::cout << " --i-am-really-stupid - Omits root user privileges check (why would you do that?)\n";
|
||||
std::cout << " --version -v - Print this binary's version\n";
|
||||
}
|
||||
@@ -33,9 +34,9 @@ int main(int argc, char** argv) {
|
||||
throwError("XDG_RUNTIME_DIR is not set!");
|
||||
|
||||
// export HYPRLAND_CMD
|
||||
std::string cmd = "";
|
||||
for (auto i = 0; i < argc; ++i)
|
||||
cmd += std::string(i == 0 ? "" : " ") + argv[i];
|
||||
std::string cmd = argv[0];
|
||||
for (int i = 1; i < argc; ++i)
|
||||
cmd += std::string(" ") + argv[i];
|
||||
|
||||
setenv("HYPRLAND_CMD", cmd.c_str(), 1);
|
||||
setenv("XDG_BACKEND", "wayland", 1);
|
||||
@@ -116,32 +117,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
return 0;
|
||||
} else if (it->compare("-v") == 0 || it->compare("--version") == 0) {
|
||||
auto result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH;
|
||||
auto dirty = std::string(GIT_DIRTY);
|
||||
if (!dirty.empty())
|
||||
result += " " + dirty;
|
||||
|
||||
auto commitMsg = trim(GIT_COMMIT_MESSAGE);
|
||||
std::replace(commitMsg.begin(), commitMsg.end(), '#', ' ');
|
||||
result += " (" + commitMsg + ").";
|
||||
|
||||
result += "\nDate: " + std::string(GIT_COMMIT_DATE);
|
||||
result += "\nTag: " + std::string(GIT_TAG) + ", commits: " + std::string(GIT_COMMITS);
|
||||
result += "\nbuilt against aquamarine " + std::string(AQUAMARINE_VERSION);
|
||||
|
||||
result += "\n\nflags: (if any)\n";
|
||||
|
||||
#ifdef LEGACY_RENDERER
|
||||
result += "legacyrenderer\n";
|
||||
#endif
|
||||
#ifndef ISDEBUG
|
||||
result += "debug\n";
|
||||
#endif
|
||||
#ifdef NO_XWAYLAND
|
||||
result += "no xwayland\n";
|
||||
#endif
|
||||
|
||||
std::cout << result;
|
||||
std::cout << versionRequest(eHyprCtlOutputFormat::FORMAT_NORMAL, "") << std::endl;
|
||||
return 0;
|
||||
} else if (it->compare("--systeminfo") == 0) {
|
||||
const auto SYSINFO = systemInfoRequest(eHyprCtlOutputFormat::FORMAT_NORMAL, "");
|
||||
|
Reference in New Issue
Block a user