From e22a8d437bf5f099ccb6a6957df6fbd9d4ecec6a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 29 Sep 2024 18:24:57 +0100 Subject: [PATCH] core: add --version --- CMakeLists.txt | 2 ++ src/hyprpicker.cpp | 2 +- src/main.cpp | 10 ++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fdff9f..f54d6a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ project( set(CMAKE_MESSAGE_LOG_LEVEL "STATUS") +add_compile_definitions(HYPRPICKER_VERSION="${VERSION}") + message(STATUS "Configuring hyprpicker!") # Get git info hash and branch diff --git a/src/hyprpicker.cpp b/src/hyprpicker.cpp index ad7d1c5..6df5ef1 100644 --- a/src/hyprpicker.cpp +++ b/src/hyprpicker.cpp @@ -387,7 +387,7 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) { if (!m_bNoZoom) { cairo_save(PCAIRO); - const auto CLICKPOSBUF = CLICKPOS / PBUFFER->pixelSize * pSurface->screenBuffer->pixelSize; + const auto CLICKPOSBUF = CLICKPOS / PBUFFER->pixelSize * pSurface->screenBuffer->pixelSize; const auto PIXCOLOR = getColorFromPixel(pSurface, CLICKPOSBUF); cairo_set_source_rgba(PCAIRO, PIXCOLOR.r / 255.f, PIXCOLOR.g / 255.f, PIXCOLOR.b / 255.f, PIXCOLOR.a / 255.f); diff --git a/src/main.cpp b/src/main.cpp index 6b91e58..0d023e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,7 +14,8 @@ static void help(void) { << " -z | --no-zoom | Disable the zoom lens\n" << " -q | --quiet | Disable most logs (leaves errors)\n" << " -v | --verbose | Enable more logs\n" - << " -t | --no-fractional | Disable fractional scaling support\n"; + << " -t | --no-fractional | Disable fractional scaling support\n" + << " -V | --version | Print version info\n"; } int main(int argc, char** argv, char** envp) { @@ -31,9 +32,10 @@ int main(int argc, char** argv, char** envp) { {"no-fractional", no_argument, NULL, 't'}, {"quiet", no_argument, NULL, 'q'}, {"verbose", no_argument, NULL, 'v'}, + {"version", no_argument, NULL, 'V'}, {NULL, 0, NULL, 0}}; - int c = getopt_long(argc, argv, ":f:hnarzqvt", long_options, &option_index); + int c = getopt_long(argc, argv, ":f:hnarzqvtV", long_options, &option_index); if (c == -1) break; @@ -62,6 +64,10 @@ int main(int argc, char** argv, char** envp) { case 't': g_pHyprpicker->m_bNoFractional = true; break; case 'q': Debug::quiet = true; break; case 'v': Debug::verbose = true; break; + case 'V': { + std::cout << "hyprpicker v" << HYPRPICKER_VERSION << "\n"; + exit(0); + } default: help(); exit(1); }