Reading all currently pressed keys in Clojure

119 Views Asked by At

Is there a way of getting a list of all currently pressed keys in a Lanterna Terminal/Screen?

i.e. not getting the last pressed key, neither waiting for a key to be pressed. I'd like to get a list of all keys that are currently being held down.

I realize this could be a limitation with lanterna with terminals. If so, is there an alternative for implementing a text UI that support polling pressed keys?

1

There are 1 best solutions below

1
amalloy On

I don't think the software interface to keyboards typically exposes a way to ask this question. As far as I know, the best approach is to build it yourself: watch for key-down and key-up events, and maintain a set of the keys which have gone down without a later up event.