Switch GNU Screen windows with F-keys on PuTTy

1

I'm trying to use the f-keys to switch windows on GNU Screen/PuTTy, but I can't get it to work.

This is my current .screenrc:

bindkey -k k1 select 1
bindkey -k k2 select 2
bindkey -k k3 select 3
(...)

Changing the PuTTy keyboard options to "XTerm R6" did not work. I also don't know how discover what keycode is being received by screen when I press a key on Putty.

Edit:

Problem solved! Turns out I had to close and reopen the screen session for the configuration to take effect (I was detaching and reattaching).

My current .screenrc is:

bindkey "\033OP" select 0
bindkey "\033OQ" select 1
bindkey "\033OR" select 2
bindkey "\033OS" select 3
bindkey "\033[15~" select 4
bindkey "\033[16~" select 5
bindkey "\033[17~" select 6
bindkey "\033[18~" select 7
bindkey "\033[19~" select 8

And PuTTy is set to VT100+.

lzm

Posted 2012-07-06T18:52:10.067

Reputation: 215

Do you want to change the TTY? Like you do with ctrl+alt+fn? – fmanco – 2012-07-06T18:54:49.017

@criziot No, I want to change windows inside a GNU Screen session – lzm – 2012-07-06T18:59:18.827

Sorry. I miss the "screen" part. Maybe this can help.

– fmanco – 2012-07-06T19:03:25.493

That helped (ctrl-v), but I still cant get it to work. I also tried the instructions here with no success.

– lzm – 2012-07-06T19:13:10.747

1Nice you found a solution. But don't put it the in the Question. Answer your own question. – fmanco – 2012-07-06T21:08:57.647

Answers

0

First, you need to figure out what your F1 key produce. I used emacs to do that.

  1. Login your system remotely with putty
  2. Run screen, and then
  3. run emacs -nw
  4. switch to *scratch* buffer (or whatever)
  5. Hit C-q F1 (C-q is quoted-insert and this will puts exact byte you get from F1 key)
  6. Copy that string to your .screenrc

My system, putty on windows accessing Debian unstable amd64 with screen 4.1.0~201203, got ^[[11~, so I put

bindkey "^[[11~" select 1

in my .screenrc and it seems to work.

Hope this helps.

Yasushi Shoji

Posted 2012-07-06T18:52:10.067

Reputation: 686