From 9f23e70bb494107df8f959c925d4521a298c65eb Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 18 Nov 2024 19:42:36 +0000 Subject: [PATCH] core: add --version --- CMakeLists.txt | 2 ++ src/main.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d60b42..4dfb8a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,8 @@ else() message(STATUS "Configuring hypridle in Release with CMake") endif() +add_compile_definitions(HYPRIDLE_VERSION="${VERSION}") + include_directories(. "protocols/") include(GNUInstallDirs) diff --git a/src/main.cpp b/src/main.cpp index 71dbd1f..1a8d316 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,11 @@ int main(int argc, char** argv, char** envp) { else if (arg == "--quiet" || arg == "-q") Debug::quiet = true; + else if (arg == "--version" || arg == "-V") { + Debug::log(NONE, "hypridle v{}", HYPRIDLE_VERSION); + return 0; + } + else if (arg == "--config" || arg == "-c") { if (i + 1 >= argc) { Debug::log(NONE, "After " + arg + " you should provide a path to a config file.");