LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to define function keys to switch terminals in GNU Screen (https://www.linuxquestions.org/questions/linux-software-2/how-to-define-function-keys-to-switch-terminals-in-gnu-screen-740617/)

x_terminat_or_3 07-16-2009 03:48 PM

How to define function keys to switch terminals in GNU Screen
 
Hi there

I would like to know if it is possible, and if so, how, to program the function keys (or multi-media keys) to work inside GNU Screen to, for instance, switch to screen 1, 2, . ., bring up the list of all available screens, split the screen, do copy, etc.

Does anyone know of a way to do this? It would make this staple program even more awesome.

Thank you kindly all you gentle souls, in particular GrapefruitGirl :)

x_terminat_or_3 07-19-2009 03:59 AM

Hi

It seems that nobody has the answer to this question. So I did some extensive research in it myself. I discovered many amazing things that screen can do, and I found the answer to my question:

Put this in your /etc/screenrc file, or in your own personal one: ~/.screenrc

Code:

bindkey -k k1 select 0
bindkey -k k2 select 1
bindkey -k k3 select 2
bindkey -k k4 select 3
bindkey -k k5 select 4
bindkey -k k6 select 5
bindkey -k k8 select 6
bindkey -k k9 select 7

For some reason it didn't know about keys F10-F12, so I still want to know how to do them, but for now, it's a great improvement indeed!

blackhole54 07-19-2009 08:04 PM

Thanks for the information. I didn't know that.

Quote:

Originally Posted by x_terminat_or_3 (Post 3612536)
For some reason it didn't know about keys F10-F12, so I still want to know how to do them, but for now, it's a great improvement indeed!

I think this is a limitation of termcap (see man 5 termcap). While I haven't tried it, based on that man page I think the following will work for F10:

Code:

bindkey -k k; select 8
It might recognize the following for F11 and F12:

Code:

bindkey -k F1 select 9
bindkey -k F2 <operation for F12>

Yeah, I know, F1 for the F11 key, etc, is counterintuitive. My guess is there is some historical reason for it.

x_terminat_or_3 07-20-2009 12:13 AM

You're right, thanks. I did find out about those weirdness late in the yesterday evening and they actually work!


All times are GMT -5. The time now is 10:51 PM.