My app reading escape sequences from terminal in raw mode. And when it’s running on xterm I got F2 like “\eOQ”. But when it’s running in linux tty terminal (Switching by Ctrl-Alt-F1) I got “\e[[[B”.
What is the correct way to determine that I got F2 independent from terminal type application running on?
My app reading escape sequences from terminal in raw mode. And when it’s running
Share
If you’re wanting to read terminal keypresses, you likely want to look at something like libtermkey , which abstracts the general problem away for you. Internally it uses a combination of
terminfolookups, or hardcoded knowledge of the extendedxterm-like model for modified keypresses, so it can understand things likeCtrl-Up, which a regular curses/etc… cannot.