crossterm icon indicating copy to clipboard operation
crossterm copied to clipboard

Support key/mouse up events for linux.

Open wendajiang opened this issue 3 years ago • 5 comments

Describe the solution you'd like for example, I want do something when I press up a key(e.g. 'h')

Describe alternatives you've considered in any different KeyCode into KeyCodeDown and KeyCodeUp if it needn't backforward compatible

wendajiang avatar Dec 25 '21 07:12 wendajiang

Maybe something as described here could be implemented: https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html#

And just a simple boolean to indicate a press/release in KeyEvent: https://github.com/crossterm-rs/crossterm/blob/master/src/event.rs#L390

TimonPost avatar Dec 26 '21 09:12 TimonPost

https://blog.robertelder.org/detect-keyup-event-linux-terminal/

Detecting a key release in linux usually require root (unless you rely on x server) , if the user is in the input group he can read it with no more previlage but I dont know which distros do his

sigmaSd avatar Dec 26 '21 12:12 sigmaSd

It would be really nice to have the option of detecting keyup events, even if that means the user has to be in the input group or have sudo rights. A lot of cli applications require sudo anyway. If the user is neither sudo, nor in the input group, the event handler could just return a Error in the Result.

dataO1 avatar Feb 09 '22 12:02 dataO1

Renaming the issue, since windows does mouse-up event support.

TimonPost avatar Jul 02 '22 20:07 TimonPost

Linux already supported mouse up/down events, its the keys support that is missing.

This commit https://github.com/crossterm-rs/crossterm/commit/60e51be726f00b8df9c79b72a55d6b9f2a40a507 fixes this by using the kitty protocol. (but you need a supported terminal)

sigmaSd avatar Jul 30 '22 11:07 sigmaSd

Gonna close this in favor of #695

TimonPost avatar Jan 11 '23 20:01 TimonPost