kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
23.8k stars 961 forks source link

Send key to child instead of text #1923

Closed WrayOfSunshine closed 5 years ago

WrayOfSunshine commented 5 years ago

I have a program (tinyfugue) that has special functionality for numpad keys. However, since kitty sends the numpad keys (per kitty --debug-keyboard) as text instead of as keys, it can't differentiate these keys from the ones not on the numpad.

If it doesn't exist already I'd like a way to configure it to send numpad buttons as keys rather than as text. If this does exist I wasn't able to find it in documentation and please enlighten me.

kovidgoyal commented 5 years ago

Traditional terminal protocols have no support for numpad keys, use the extended kitty keyboard protocol for that: https://sw.kovidgoyal.net/kitty/protocol-extensions.html#keyboard-handling

WrayOfSunshine commented 5 years ago

I'm intrigued you say that since urxvt handles this and indeed so does just not loading X - the actual terminal handles this just fine. xterm in theory handles this via "application mode" but I don't see an option to move into or out of application mode manually in kitty.

WrayOfSunshine commented 5 years ago

In fact, I just tested the "full mode" and it still does not appear to do what I'm asking for, which is strictly to send the key from the numpad unmolested to the program.

kovidgoyal commented 5 years ago

I have no idea what you are saying. All key presses are converted to "text" and sent to terminal programs. Some of that "text" is plain ascii codes, some are escape codes and some are actual ASCII characters. In full mode and application mode, which you switch between using escape codes, the bytes sent for some special keys change. How those bytes are interpreted depends on the terminals terminfo, which any terminal program must read and use. If you want to see what bytes are sent for different keypresses, run the program

showkey -a

in the terminal you are testing.

kovidgoyal commented 5 years ago

Oh and showkey does not know about the kitty extended keyboard protocol, for that use,

kitty +kitten key_demo