gizak / termui

Golang terminal dashboard
MIT License
13.11k stars 786 forks source link

Keys doesn't works #140

Closed marcuxyz closed 5 years ago

marcuxyz commented 7 years ago

When trying to use keys like Q to exit for example. The app does not respond, I have to close the terminal in hand.

Ubuntu / Linux is what I use.

dh1tw commented 7 years ago

are you running the unmodified example?

Can you confirm that an event handler exists?

    termui.Handle("/sys/kbd/q", func(termui.Event) {
        termui.StopLoop()
    })

Here the examples work as expected with Ubuntu 16.04 and 14.04.

dongyuhappy commented 6 years ago

I have also encountered this problem. MacOS is what i use

samaddison commented 5 years ago

In my Mac (10.13.16) I found that if you use the code in the example:

ui.Handle("c", func(ui.Event) {
        ui.StopLoop()
    })

It won't work, but it works if you use

ui.Handle("/sys/kbd/c", func(ui.Event) {
        fmt.Println("Pressed c")
        ui.StopLoop()
    })

As mentioned above.

cjbassi commented 5 years ago

Events have been reworked so you can use the method documented in the readme now and everything should work. :+1: