From 154fadf876326731fe0e1bdd15438ca2e741a343 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 13 Oct 2024 18:23:05 +0100 Subject: [PATCH] core: parse commit if no tag --- src/main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 728f132..d27b7f9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,12 +52,22 @@ static void getSystemInfo(CSystemInternals* hsi) { if (getenv("HYPRLAND_INSTANCE_SIGNATURE")) { const auto DATA = execAndGet("hyprctl version"); hsi->hlSystemVersion = DATA.c_str(); - if (DATA.contains("Hyprland")) { + + if (DATA.contains("Tag:")) { auto temp = DATA.substr(DATA.find("Tag:") + 5); temp = temp.substr(0, temp.find(",")); hsi->hyprlandVersionLong = temp.c_str(); hsi->hyprlandVersion = temp.substr(0, temp.find("-")).c_str(); - } else { + } + + if (hsi->hyprlandVersionLong.length() <= 0 && DATA.contains("at commit")) { + auto temp = DATA.substr(DATA.find("at commit") + 10); + temp = temp.substr(0, temp.find(" ")); + hsi->hyprlandVersionLong = temp.substr(0, 7).c_str(); + hsi->hyprlandVersion = temp.substr(0, 7).c_str(); + } + + if (hsi->hyprlandVersionLong.length() <= 0) { hsi->hyprlandVersionLong = "unknown"; hsi->hyprlandVersion = "unknown"; }