As a long-time lurker on Stack Exchange, I've found answers to most of my problems without needing to so much as make an account. But today I'm completely stumped with this issue, so I'm reaching out for help.
I've recently discovered Byobu, a frontend for Tmux which uses the Fn keys for common tasks. It's a real blessing for multitasking through SSH to a remote linux server from the Windows PC I have to use at work.
Currently, I'm using gnome-terminal through an SSH tunnel because both PuTTY and MinTTY (the default terminal with Cygwin) seem to send the wrong key codes for the function keys.
I was wondering if there was a way to re-map certain escape codes so at least one of my windows-based terminals can work properly with Tmux. (I guess I could just learn the Ctrl+b/Ctrl+a key combinations, but performing a key combination followed by another key doesn't really strike me as ergonomic.)
In PuTTY, setting Terminal>Keyboard>"The Function keys and keypad" to "XtermR6" seems to push the correct escape sequences for the Fn keys normally, but the Shift and Ctrl modifiers are broken. I can use vim to figure out what codes are being sent by each terminal. Meanwhile, I think I might have looked up the combination tmux is looking for in its source code, but I'm not sure:
Key Tmux Expects Gnome-Terminal PuTTY MinTTY
Normal F3: ^[0R ^[0R ^[0R
Ctrl+F3 "\033[13^" ^[01;5R ^[0R ^[[1;5R
Shift+F3 "\033[13$" ^[01;2R ^[[25~ ^[[1;2R
Ctrl+Shift+F3 "\033[13@" ^[01;6R ^[[25~ ^[[1;6R
So far, MinTTY looks like the best candidate, but it gives me an entirely different problem where byobu ignores 95% of Fn key presses, passing them directly to the client application. I can run cat -v and spam the F2 (new window) key, and it'll print out "^[0Q" four or five times before suddenly spawning a new window.
If anyone has advice, it would be welcome. Most of the stuff I found on the internet said to change the terminal type, but I've tried literally every combination each of the two programs offer.
Thanks!
kf3
from whatever TERM you are using when attaching to tmux) as well as the xterm-style modified-key sequences fromxterm-keys.c
. So, the sequences that you report from Gnome-Terminal and MinTTY (although the escape+zeros in your sequences should be escape+letter-ohs (a.k.a. SS3) should be recognized by tmux, but it will only pass them through if you have thexterm-keys
option enabled.