gizak / termui

Golang terminal dashboard
MIT License
13.14k stars 787 forks source link

Handle 'down' keypress event #104

Closed hasit closed 7 years ago

hasit commented 7 years ago

Hello @gizak,

I am writing an app using termui and I want to handle an event where user presses the down key. This is what I have so far,

termui.Handle("/sys/kbd/down", func(termui.Event) {
   someFunction()
})

Is this the correct way? Also, where can I get these key identifiers that you have used in your examples such as /sys/kbd/q and /sys/kbd/C-x?

hasit commented 7 years ago

Solved it!

This is how it got it,

termui.Handle("/sys/kbd/<down>", func(e termui.Event) {
    fmt.Println(e.Data.(termui.EvtKbd))
})

And so the 'down' key is /sys/kbd/<down>.

Closing the issue.