Ubuntu: Bind Alt-N to Nth window in byobu/screen



Question:

I've been trying to bind a shortcut to switching to a specific window in byobu, but I'm not having success. I wanted to bind Alt-(screen's number) but it's not working. I think I'm using the wrong ASCII codes.

Take Alt-1 for example: I've tried using the lines
bind \078 select 1
and
bind \78 select 1
to both ~/.screeenrc and ~/.config/byobu/keybindings, but neither worked.

Am I using the wrong code, or is there no standard ASCII code for Alt-1?


Solution:1

First check what octal code is generated when you press alt+1, type in the following:

echo -n C-qM-1 | od -t o1  

(If that makes no sense to you: instead of writing C-q, press ctrl-q and for M-1 substitute alt-1, and some character should show up). For example, I have Finnish keyboard and en_US.UTF-8 locale and get:

0000000 302 261  

so I put in my .screenrc:

bindkey "\302\261" select 1  

Note: by default this will not work in a gnome-terminal at all, since alt+number changes the tab and screen (or bash) doesn't get a chance to see the keypress. Go to Edit > Keyboards Shortcuts... to change the shortcuts.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »