diff --git a/CMakeLists.txt b/CMakeLists.txt index c2dfd6c..8b75b99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value # position independent build: __FILE__ add_compile_options(-fmacro-prefix-map=${CMAKE_SOURCE_DIR}/=) +add_compile_definitions(HYPRLOCK_VERSION="${VERSION}") # dependencies message(STATUS "Checking deps...") diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index 2dc881c..fa30c31 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -829,8 +829,7 @@ void CHyprlock::startKeyRepeat(xkb_keysym_t sym) { if (m_iKeebRepeatDelay <= 0) return; - m_pKeyRepeatTimer = addTimer( - std::chrono::milliseconds(m_iKeebRepeatDelay), [sym](std::shared_ptr self, void* data) { g_pHyprlock->repeatKey(sym); }, nullptr); + m_pKeyRepeatTimer = addTimer(std::chrono::milliseconds(m_iKeebRepeatDelay), [sym](std::shared_ptr self, void* data) { g_pHyprlock->repeatKey(sym); }, nullptr); } void CHyprlock::repeatKey(xkb_keysym_t sym) { @@ -841,8 +840,7 @@ void CHyprlock::repeatKey(xkb_keysym_t sym) { // This condition is for backspace and delete keys, but should also be ok for other keysyms since our buffer won't be empty anyways if (bool CONTINUE = m_sPasswordState.passBuffer.length() > 0; CONTINUE) - m_pKeyRepeatTimer = addTimer( - std::chrono::milliseconds(m_iKeebRepeatRate), [sym](std::shared_ptr self, void* data) { g_pHyprlock->repeatKey(sym); }, nullptr); + m_pKeyRepeatTimer = addTimer(std::chrono::milliseconds(m_iKeebRepeatRate), [sym](std::shared_ptr self, void* data) { g_pHyprlock->repeatKey(sym); }, nullptr); renderAllOutputs(); } @@ -1051,8 +1049,7 @@ std::vector> CHyprlock::getTimers() { } void CHyprlock::enqueueForceUpdateTimers() { - addTimer( - std::chrono::milliseconds(1), [](std::shared_ptr self, void* data) { forceUpdateTimers(); }, nullptr, false); + addTimer(std::chrono::milliseconds(1), [](std::shared_ptr self, void* data) { forceUpdateTimers(); }, nullptr, false); } void CHyprlock::spawnAsync(const std::string& args) { diff --git a/src/helpers/Log.hpp b/src/helpers/Log.hpp index d2bf211..863512e 100644 --- a/src/helpers/Log.hpp +++ b/src/helpers/Log.hpp @@ -19,7 +19,7 @@ enum eLogLevel { std::format(reason, ##__VA_ARGS__), __LINE__, \ ([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \ printf("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \ - std::abort(); \ + std::abort(); \ } #define ASSERT(expr) RASSERT(expr, "?") diff --git a/src/helpers/MiscFunctions.hpp b/src/helpers/MiscFunctions.hpp index bbac1a0..afab9be 100644 --- a/src/helpers/MiscFunctions.hpp +++ b/src/helpers/MiscFunctions.hpp @@ -2,5 +2,4 @@ #include - std::string absolutePath(const std::string&, const std::string&); diff --git a/src/main.cpp b/src/main.cpp index f97945e..a5270ad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,6 +41,11 @@ int main(int argc, char** argv, char** envp) { if (arg == "--verbose" || arg == "-v") Debug::verbose = true; + if (arg == "--version" || arg == "-V") { + std::cout << "Hyprlock version " << HYPRLOCK_VERSION << "\n"; + return 0; + } + else if (arg == "--quiet" || arg == "-q") Debug::quiet = true;