mirror of
https://github.com/hyprwm/hyprsysteminfo.git
synced 2024-12-25 19:49:48 +01:00
core: parse commit if no tag
This commit is contained in:
parent
53d0696a46
commit
154fadf876
1 changed files with 12 additions and 2 deletions
14
src/main.cpp
14
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";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue