feat(nix-monitor): add optimize store

This commit is contained in:
avivbintangaringga
2026-07-18 13:59:54 +07:00
parent f96cba053f
commit fd1014fc76
3 changed files with 48 additions and 0 deletions
+28
View File
@@ -119,6 +119,19 @@ local function render()
end
end
if not cfg("hide_optimize_button") then
table.insert(
buttons,
ui.button({
text = tr("panel.optimize"),
glyph = "database-cog",
flexGrow = 1,
variant = "primary",
onClick = "onOptimizeClicked",
})
)
end
if not cfg("hide_clean_button") then
table.insert(
buttons,
@@ -273,3 +286,18 @@ function onCleanClicked()
panel.close()
noctalia.runInTerminal(command)
end
function onOptimizeClicked()
local command = cfg("optimize_command")
if command == "" then
noctalia.notifyError(tr("notification.optimize_command_is_empty"))
return
end
if cfg("close_on_enter") then
command = `{command} && echo && read -p "{tr("terminal.press_enter_to_exit")}"`
end
panel.close()
noctalia.runInTerminal(command)
end