fix(nix-monitor): hide home-manager if there is empty output
This commit is contained in:
@@ -146,20 +146,20 @@ function checkGenerations()
|
|||||||
setState("lastGenerationsCheckTime", os.time())
|
setState("lastGenerationsCheckTime", os.time())
|
||||||
|
|
||||||
noctalia.runAsync(nixosGenerationsCmd, function(result)
|
noctalia.runAsync(nixosGenerationsCmd, function(result)
|
||||||
setState("nixosGenerations", result.stdout)
|
setState("nixosGenerations", noctalia.string.trim(result.stdout))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
noctalia.runAsync(nixosCurrentGenCmd, function(result)
|
noctalia.runAsync(nixosCurrentGenCmd, function(result)
|
||||||
setState("nixosCurrentGen", result.stdout)
|
setState("nixosCurrentGen", noctalia.string.trim(result.stdout))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if getState("hasHomeManager") then
|
if getState("hasHomeManager") then
|
||||||
noctalia.runAsync(hmGenerationsCmd, function(result)
|
noctalia.runAsync(hmGenerationsCmd, function(result)
|
||||||
setState("hmGenerations", result.stdout)
|
setState("hmGenerations", noctalia.string.trim(result.stdout))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
noctalia.runAsync(hmCurrentGenCmd, function(result)
|
noctalia.runAsync(hmCurrentGenCmd, function(result)
|
||||||
setState("hmCurrentGen", result.stdout)
|
setState("hmCurrentGen", noctalia.string.trim(result.stdout))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -110,7 +110,8 @@ local function render()
|
|||||||
statLabel(`{tr("panel.current")}: {getState("nixosCurrentGen")}`, "device-desktop-check")
|
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,
|
table.insert(generationItems,
|
||||||
statLabel(`HM: {getState("hmGenerations")}`, "home")
|
statLabel(`HM: {getState("hmGenerations")}`, "home")
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user