diff --git a/src/ttop/onoff.nim b/src/ttop/onoff.nim index 3f41666..6ee926b 100644 --- a/src/ttop/onoff.nim +++ b/src/ttop/onoff.nim @@ -86,10 +86,12 @@ proc onOffSystemd(enable: bool) = discard cmd(&"systemctl is-active '{unit}.timer'", true) createConfig() discard cmd &"systemctl{user} daemon-reload" + discard cmd &"systemctl{user} enable '{unit}.timer'" discard cmd &"systemctl{user} start '{unit}.timer'" discard cmd "loginctl enable-linger" else: discard cmd &"systemctl{user} stop '{unit}.timer'" + discard cmd &"systemctl{user} disable '{unit}.timer'" deleteConfig() discard cmd &"systemctl{user} daemon-reload" discard cmd "loginctl disable-linger" diff --git a/src/ttop/tui.nim b/src/ttop/tui.nim index f4a9d04..1304c75 100644 --- a/src/ttop/tui.nim +++ b/src/ttop/tui.nim @@ -11,9 +11,11 @@ import format import sequtils import blog import asciigraph +from terminal import setCursorXPos proc exitProc() {.noconv.} = illwillDeinit() + setCursorXPos(0) showCursor() quit(0) @@ -318,9 +320,7 @@ proc tui*() = initSensors() init() illwillInit(fullscreen = true) - defer: - illwillDeinit() - showCursor() + defer: exitProc() setControlCHook(exitProc) hideCursor() var draw = false