How do I make the F-keys work in byobu, for midnight commander (mc), htop, etc?

You can easily toggle on/off the use of the F-keys inside of Byobu (tmux) by pressing either:

  • shift-F12 (in tmux)

  • ctrl-a-! (in screen)

Full disclosure: I'm the author and maintainer of Byobu.


On midnight commander to trigger for example the F2 key:

  • Press Alt+2 (simultaneously)
  • Press ESC, 2 (one after the other).

Which is more convenient than switching using:

  • Shift+F12 (in tmux, default on byobu)

  • Ctrl+A+! (in screen)


Hah, a man after my own heart :)

Short answer: add my ppa (ppa:izx/private) and update byobu (or manually install the deb). Byobu will default to screen as the backend with F-key behavior restored to old 4.x style.

Long answer: Use byobu-select-backend to switch to screen if you haven't already, and add line $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable after the line $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen in /usr/share/byobu/keybindings/common.

Entire patch:

+++ byobu-5.17/usr/share/byobu/keybindings/common
@@ -1 +1,3 @@
 source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen
+source $BYOBU_PREFIX/share/byobu/keybindings/f-keys.screen.disable
+
--- byobu-5.17.orig/etc/byobu/backend
+++ byobu-5.17/etc/byobu/backend
@@ -1,4 +1,4 @@
 # BYOBU_BACKEND can currently be "screen" or "tmux"
 # Override this on a per-user basis by editing "$BYOBU_CONFIG_DIR/backend"
 # or by launching either "byobu-screen" or "byobu-tmux" instead of "byobu".
-#BYOBU_BACKEND="tmux"
+BYOBU_BACKEND="screen"