Cannot make function key bindings (F1-F12) to work in byobu with tmux backend

bashbyobukey-bindingtmux

I use Ubuntu 14.04 and have the latest version of byobu installed via apt-get. It has always worked flawlessly but started showing some weird behaviour just recently with no obvious reason. I use it with bash and tmux as the backend.

$ byobu --version
byobu version 5.74
tmux 1.8

First, byobu's function keys (F1-F12) stopped working.
Second, creating a new window (F2) or split (CTRL+F2), or leaving the opened session (CTRL+F6) also stopped working.

My $TERM environment variable is reset to screen every time I create a new window, split or similar. This causes errors when trying to open vim or even running clear, for example. Setting the variable manually (export TERM=xterm-color) and sourcing my .bashrc temporarily fixes the issue.

I deleted the byobu config dir (rm -rf ~/.byobu) following this question, ran byobu-config and changed the escape sequence to CTRL+A (the default), but when I open a new window or split the $TERM variable is still set to screen.

Possibly unrelated issue that appeared at the same time: when I type the up key in bash to scroll through the list of previous commands and try to edit the command line, it shows me as if what I type in replaces the existing characters (which is the expected behaviour when the insert key is active). Nevertheless, it just appears to do that: what actually happens in the background is the expected (it's just inserting whatever I am typing in where the cursor is).
This does not happen if I don't go to a previous command with the up key.

Still, I can't create a new window by typing F2 but I can create a new split with SHIFT+F2 or CTRL+F2.
I can create a new window, though, by typing CTRL+A c (I got the idea from this question).

How to make the keybindings for function keys (F1-F12) work as it used to (default when you press F1)?

Best Answer

Since some keybindings work in your byobu and some do not, I think it could be an issue with your terminal emulator program.

I just had that case:

  • When running byobu inside qterminal, it would not detect the F1 to F5 keybindings. F6 would work fine, though.

  • When running byobu inside gnome-terminal, everything was fine again.