feat(nix-monitor): add optimize store
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user