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

@ -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, "?")

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;