core: add --version

This commit is contained in:
Vaxry 2024-07-24 13:58:59 +02:00
parent dba9d8b517
commit 58e1a4a499
5 changed files with 10 additions and 8 deletions

View File

@ -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...")

View File

@ -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<CTimer> self, void* data) { g_pHyprlock->repeatKey(sym); }, nullptr);
m_pKeyRepeatTimer = addTimer(std::chrono::milliseconds(m_iKeebRepeatDelay), [sym](std::shared_ptr<CTimer> 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<CTimer> self, void* data) { g_pHyprlock->repeatKey(sym); }, nullptr);
m_pKeyRepeatTimer = addTimer(std::chrono::milliseconds(m_iKeebRepeatRate), [sym](std::shared_ptr<CTimer> self, void* data) { g_pHyprlock->repeatKey(sym); }, nullptr);
renderAllOutputs();
}
@ -1051,8 +1049,7 @@ std::vector<std::shared_ptr<CTimer>> CHyprlock::getTimers() {
}
void CHyprlock::enqueueForceUpdateTimers() {
addTimer(
std::chrono::milliseconds(1), [](std::shared_ptr<CTimer> self, void* data) { forceUpdateTimers(); }, nullptr, false);
addTimer(std::chrono::milliseconds(1), [](std::shared_ptr<CTimer> self, void* data) { forceUpdateTimers(); }, nullptr, false);
}
void CHyprlock::spawnAsync(const std::string& args) {

View File

@ -2,5 +2,4 @@
#include <string>
std::string absolutePath(const std::string&, const std::string&);

View File

@ -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;