mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-09-11 13:25:42 +03:00
Added hyprctl version
This commit is contained in:
parent
94811485c9
commit
e3b19e0131
@ -7,6 +7,22 @@ set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
|
|||||||
|
|
||||||
message(STATUS "Configuring Hyprland!")
|
message(STATUS "Configuring Hyprland!")
|
||||||
|
|
||||||
|
# Get git info
|
||||||
|
# hash and branch
|
||||||
|
execute_process(
|
||||||
|
COMMAND git rev-parse --abbrev-ref HEAD
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_BRANCH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND git rev-parse HEAD
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
include_directories(.)
|
include_directories(.)
|
||||||
add_compile_options(-std=c++20 -DWLR_USE_UNSTABLE )
|
add_compile_options(-std=c++20 -DWLR_USE_UNSTABLE )
|
||||||
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing)
|
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing)
|
||||||
@ -36,6 +52,9 @@ ELSE()
|
|||||||
message(STATUS "Configuring Hyprland in Release with CMake!")
|
message(STATUS "Configuring Hyprland in Release with CMake!")
|
||||||
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||||
|
|
||||||
|
target_compile_definitions(Hyprland PRIVATE "-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
|
||||||
|
target_compile_definitions(Hyprland PRIVATE "-DGIT_BRANCH=\"${GIT_BRANCH}\"")
|
||||||
|
|
||||||
target_link_libraries(Hyprland rt)
|
target_link_libraries(Hyprland rt)
|
||||||
|
|
||||||
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
||||||
|
@ -24,6 +24,7 @@ usage: hyprctl [command] [(opt)args]
|
|||||||
layers
|
layers
|
||||||
dispatch
|
dispatch
|
||||||
keyword
|
keyword
|
||||||
|
version
|
||||||
)#";
|
)#";
|
||||||
|
|
||||||
void request(std::string arg) {
|
void request(std::string arg) {
|
||||||
@ -134,6 +135,7 @@ int main(int argc, char** argv) {
|
|||||||
else if (!strcmp(argv[1], "workspaces")) request("workspaces");
|
else if (!strcmp(argv[1], "workspaces")) request("workspaces");
|
||||||
else if (!strcmp(argv[1], "activewindow")) request("activewindow");
|
else if (!strcmp(argv[1], "activewindow")) request("activewindow");
|
||||||
else if (!strcmp(argv[1], "layers")) request("layers");
|
else if (!strcmp(argv[1], "layers")) request("layers");
|
||||||
|
else if (!strcmp(argv[1], "version")) request("version");
|
||||||
else if (!strcmp(argv[1], "dispatch")) dispatchRequest(argc, argv);
|
else if (!strcmp(argv[1], "dispatch")) dispatchRequest(argc, argv);
|
||||||
else if (!strcmp(argv[1], "keyword")) keywordRequest(argc, argv);
|
else if (!strcmp(argv[1], "keyword")) keywordRequest(argc, argv);
|
||||||
else {
|
else {
|
||||||
|
@ -71,6 +71,22 @@ std::string layersRequest() {
|
|||||||
return result;
|
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) {
|
std::string dispatchRequest(std::string in) {
|
||||||
// get rid of the dispatch keyword
|
// get rid of the dispatch keyword
|
||||||
in = in.substr(in.find_first_of(' ') + 1);
|
in = in.substr(in.find_first_of(' ') + 1);
|
||||||
@ -131,6 +147,8 @@ void HyprCtl::tickHyprCtl() {
|
|||||||
reply = activeWindowRequest();
|
reply = activeWindowRequest();
|
||||||
else if (request == "layers")
|
else if (request == "layers")
|
||||||
reply = layersRequest();
|
reply = layersRequest();
|
||||||
|
else if (request == "version")
|
||||||
|
reply = versionRequest();
|
||||||
else if (request.find("dispatch") == 0)
|
else if (request.find("dispatch") == 0)
|
||||||
reply = dispatchRequest(request);
|
reply = dispatchRequest(request);
|
||||||
else if (request.find("keyword") == 0)
|
else if (request.find("keyword") == 0)
|
||||||
|
@ -49,4 +49,12 @@
|
|||||||
#define RASSERT(expr, reason, ...)
|
#define RASSERT(expr, reason, ...)
|
||||||
#endif
|
#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
|
Loading…
Reference in New Issue
Block a user