mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
add ctrl+c exit handler
This commit is contained in:
parent
8a6808c804
commit
2f17a9d689
14
grid.go
14
grid.go
@ -77,17 +77,16 @@ func Display() bool {
|
|||||||
cursor.RefreshContainers()
|
cursor.RefreshContainers()
|
||||||
RedrawRows(true)
|
RedrawRows(true)
|
||||||
|
|
||||||
ui.Handle("/sys/kbd/<up>", func(ui.Event) {
|
ui.Handle("/sys/kbd/<up>", func(ui.Event) { cursor.Up() })
|
||||||
cursor.Up()
|
ui.Handle("/sys/kbd/<down>", func(ui.Event) { cursor.Down() })
|
||||||
})
|
|
||||||
ui.Handle("/sys/kbd/<down>", func(ui.Event) {
|
|
||||||
cursor.Down()
|
|
||||||
})
|
|
||||||
ui.Handle("/sys/kbd/<enter>", func(ui.Event) {
|
ui.Handle("/sys/kbd/<enter>", func(ui.Event) {
|
||||||
expand = true
|
expand = true
|
||||||
ui.StopLoop()
|
ui.StopLoop()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ui.Handle("/sys/kbd/q", func(ui.Event) { ui.StopLoop() })
|
||||||
|
ui.Handle("/sys/kbd/C-c", func(ui.Event) { ui.StopLoop() })
|
||||||
|
|
||||||
ui.Handle("/sys/kbd/a", func(ui.Event) {
|
ui.Handle("/sys/kbd/a", func(ui.Event) {
|
||||||
config.Toggle("allContainers")
|
config.Toggle("allContainers")
|
||||||
RefreshDisplay()
|
RefreshDisplay()
|
||||||
@ -107,9 +106,6 @@ func Display() bool {
|
|||||||
config.Toggle("enableHeader")
|
config.Toggle("enableHeader")
|
||||||
RedrawRows(true)
|
RedrawRows(true)
|
||||||
})
|
})
|
||||||
ui.Handle("/sys/kbd/q", func(ui.Event) {
|
|
||||||
ui.StopLoop()
|
|
||||||
})
|
|
||||||
ui.Handle("/sys/kbd/r", func(e ui.Event) {
|
ui.Handle("/sys/kbd/r", func(e ui.Event) {
|
||||||
config.Toggle("sortReversed")
|
config.Toggle("sortReversed")
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user