Added hyprctl version

This commit is contained in:
vaxerski 2022-04-22 18:14:25 +02:00
parent 94811485c9
commit e3b19e0131
4 changed files with 48 additions and 1 deletions

View file

@ -71,6 +71,22 @@ std::string layersRequest() {
return result;
}
std::string versionRequest() {
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + ", flags: (if any)\n";
#ifdef LEGACY_RENDERER
result += "legacyrenderer\n";
#endif
#ifndef NDEBUG
result += "debug\n";
#endif
#ifdef NO_XWAYLAND
result += "no xwayland\n";
#endif
return result;
}
std::string dispatchRequest(std::string in) {
// get rid of the dispatch keyword
in = in.substr(in.find_first_of(' ') + 1);
@ -131,6 +147,8 @@ void HyprCtl::tickHyprCtl() {
reply = activeWindowRequest();
else if (request == "layers")
reply = layersRequest();
else if (request == "version")
reply = versionRequest();
else if (request.find("dispatch") == 0)
reply = dispatchRequest(request);
else if (request.find("keyword") == 0)

View file

@ -49,4 +49,12 @@
#define RASSERT(expr, reason, ...)
#endif
#define ASSERT(expr) RASSERT(expr, "?")
#define ASSERT(expr) RASSERT(expr, "?")
// git stuff
#ifndef GIT_COMMIT_HASH
#define GIT_COMMIT_HASH "?"
#endif
#ifndef GIT_BRANCH
#define GIT_BRANCH "?"
#endif