New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support lone Alt key presses in KeyFunctions #1245
Conversation
A lone Alt key press in Windows applications normally brings up the application menu bar (which is why its virtual keycode is VK_MENU). There's no such menu bar in mintty, which relies on the context menu and window menu instead, so make lone Alt key presses available for mapping in the KeyFunctions setting. The action is triggered when the Alt key is released, but only if no other modifier was down when the Alt key was pressed, and if nothing else was pressed in-between. Also make sure that AltGr does not trigger this action or Alt code processing, unless the AltGrIsAlsoAlt setting is enabled. One use case for this is to map Alt to the context menu via the 'menu-text' action, to make it easier to reach on keyboards that don't have the context menu key. Another is to map it to ^[, i.e. the Esc key code, which might be convenient for vim users. It also makes plenty of sense as Alt modifier combinations normally prefix the modified key with ^[. As the Esc key's default function can be replaced in this way, also make unmodified Esc key presses available for mapping in KeyFunctions. One use case for that is to map it to a non-letter control character such as ^\, and then use that as the interrupt character in the stty settings, instead of ^C. That gives Esc its usual Windows meaning of interrupting or cancelling actions, and makes ^C available for copying.
Added an example for this to the manual.
This can be achieved more directly and decoupled from actual ^C settings by |
Thanks!
That doesn't work with ssh though, because the SIGINT is delivered to the foreground process group of the pty that mintty created, thus killing ssh itself, whereas control chars are sent to the remote pty. (Screen on the other hand apparently translates the SIGINT sent by 'break' into the control character specified for SIGINT in the stty settings and sends that to its child process.) |
Thanks for the SIGINT hints, I just had the idea to add a user-definable function |
Released 3.7.1. |
A lone Alt key press in Windows applications normally brings up the application menu bar (which is why its virtual keycode is VK_MENU). There's no such menu bar in mintty, which relies on the context menu and window menu instead, so make lone Alt key presses available for mapping in the KeyFunctions setting.
The action is triggered when the Alt key is released, but only if no other modifier was down when the Alt key was pressed, and if nothing else was pressed in-between.
Also make sure that AltGr does not trigger this action or Alt code processing, unless the AltGrIsAlsoAlt setting is enabled.
One use case for this is to map Alt to the context menu via the 'menu-text' action, to make it easier to reach on keyboards that don't have the context menu key.
Another is to map it to ^[, i.e. the Esc key code, which might be convenient for vim users. It also makes plenty of sense as Alt modifier combinations normally prefix the modified key with ^[.
As the Esc key's default function can be replaced in this way, also make unmodified Esc key presses available for mapping in KeyFunctions. One use case for that is to map it to a non-letter control character such as ^, and then use that as the interrupt character in the stty settings, instead of ^C. That gives Esc its usual Windows meaning of interrupting or cancelling actions, and makes ^C available for copying.