Skip to content

Commit

Permalink
fix cursor after exit + enable/disable systemctl
Browse files Browse the repository at this point in the history
  • Loading branch information
inv2004 committed Jan 24, 2023
1 parent 0b25bd8 commit 6131029
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/ttop/onoff.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/ttop/tui.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -318,9 +320,7 @@ proc tui*() =
initSensors()
init()
illwillInit(fullscreen = true)
defer:
illwillDeinit()
showCursor()
defer: exitProc()
setControlCHook(exitProc)
hideCursor()
var draw = false
Expand Down

0 comments on commit 6131029

Please sign in to comment.