From 53d0696a460d7aea9eb2881c1bb3fe4f60172e10 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 13 Oct 2024 18:19:13 +0100 Subject: [PATCH] core: don't assume missing hl when no tag is set --- src/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ee1c4cd..728f132 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -50,18 +50,20 @@ static void getSystemInfo(CSystemInternals* hsi) { // get hyprland info if (getenv("HYPRLAND_INSTANCE_SIGNATURE")) { - const auto DATA = execAndGet("hyprctl version"); - if (DATA.contains("Tag:")) { - hsi->hlSystemVersion = DATA.c_str(); - + const auto DATA = execAndGet("hyprctl version"); + hsi->hlSystemVersion = DATA.c_str(); + if (DATA.contains("Hyprland")) { 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 { + hsi->hyprlandVersionLong = "unknown"; + hsi->hyprlandVersion = "unknown"; } const auto DATA2 = execAndGet("hyprctl systeminfo"); - if (DATA2.contains("Tag:")) + if (DATA2.contains("Hyprland")) hsi->hlSystemInfo = DATA2.c_str(); }