fix(nix-monitor): hide home-manager if there is empty output

This commit is contained in:
avivbintangaringga
2026-07-16 11:02:41 +07:00
parent 07671ec81c
commit 829da23ebb
2 changed files with 6 additions and 5 deletions
+4 -4
View File
@@ -146,20 +146,20 @@ function checkGenerations()
setState("lastGenerationsCheckTime", os.time())
noctalia.runAsync(nixosGenerationsCmd, function(result)
setState("nixosGenerations", result.stdout)
setState("nixosGenerations", noctalia.string.trim(result.stdout))
end)
noctalia.runAsync(nixosCurrentGenCmd, function(result)
setState("nixosCurrentGen", result.stdout)
setState("nixosCurrentGen", noctalia.string.trim(result.stdout))
end)
if getState("hasHomeManager") then
noctalia.runAsync(hmGenerationsCmd, function(result)
setState("hmGenerations", result.stdout)
setState("hmGenerations", noctalia.string.trim(result.stdout))
end)
noctalia.runAsync(hmCurrentGenCmd, function(result)
setState("hmCurrentGen", result.stdout)
setState("hmCurrentGen", noctalia.string.trim(result.stdout))
end)
end
end
+2 -1
View File
@@ -110,7 +110,8 @@ local function render()
statLabel(`{tr("panel.current")}: {getState("nixosCurrentGen")}`, "device-desktop-check")
}
if getState("hasHomeManager") then
if getState("hasHomeManager") and getState("hmGenerations") ~= ""
and getState("hmCurrentGen") ~= "" then
table.insert(generationItems,
statLabel(`HM: {getState("hmGenerations")}`, "home")
)