crossterm icon indicating copy to clipboard operation
crossterm copied to clipboard

Supporting multiple modifier key recognition (like Ctrl+Shift)

Open curlpipe opened this issue 5 years ago • 4 comments

Is your feature request related to a problem? Please describe. This is a great library, probably one of the most complete libraries I have found. The problem I'm finding is that the users of my program (that uses Crossterm) wish to be able to use keyboard shortcuts such as Ctrl+Shift and Alt+Shift etc... When I try implementing these modifiers, it just registers as usual Ctrl and Alt keys.

Describe the solution you'd like I'd like to be able to bind multiple modifier keys on top of each other. E.g. Ctrl + Shift + S or Ctrl + Alt + R etc...

Describe alternatives you've considered in any Not really sure how to get around this, I could maybe write some janky code to work around this using another library or using libc for now but I don't want to go into that territory.

Additional Info This can kinda fit into issue #510 as I think it's mentioned there But I wanted to make it clearer

Many thanks :)

curlpipe avatar Nov 22 '20 10:11 curlpipe

Example key codes sent by gnome-terminal:

Up: \e[A Shift Up: \e[1;2A Alt Up: \e[1;3A Shift+Alt Up: \e[1;4A Control Up: \e[1;5A Control+Shift Left: \e[1;6D

vlisivka avatar Nov 22 '20 11:11 vlisivka

Can this be closed with the addition of the keyboard enhancement feature to 0.25?

pianohacker avatar Oct 03 '22 17:10 pianohacker

Is this implemented? In my app I tried to catch Ctrl + Shift + c (Ctrl + C) but couldn't. FYI, changing the key from c to e.g. 'z' does not work either. If I miss something, please let me know.

kyoheiu avatar Jul 19 '23 02:07 kyoheiu

This can be done using the KeyboardEnhancementFlags if you have a terminal that supports it.

As of two weeks, it is supported by Alacritty: https://github.com/alacritty/alacritty/commit/cb03806e2ab85674c45e87e1bb24dfe2fd1a918c

LevitatingBusinessMan avatar Dec 22 '23 02:12 LevitatingBusinessMan