[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gnu screen key binding question - bind a key to: stuff a command + unbind the key binding?



On 9/3/13, davidson@ling.ohio-state.edu <davidson@ling.ohio-state.edu> wrote:
> On Tue, 3 Sep 2013, Zenaan Harkness wrote:
>
>> Does anyone know off-hand how to bind a key in .screenrc, eg
>>
>>  bindkey -k k8 screen
>>
>> so that the bound key causes some keystrokes to go into the terminal
>> to run that command, as well as "at the same time" (probably just
>> prior, or after) to unbind that same keybinding from the 'current'
>> screen session?
>
> minimally altering your example above,
>
>   bindkey -k k8 eval "stuff screen^M" 'bindkey -k k8'
>
> seems to do what you want.

Thank you. That is what I wanted.

>> Also, of note, does anyone know what the difference is between bind
>> and bindkey. I've tried reading the manpage on these two things a
>> couple times now, and I'm not properly grokking the difference for
>> some reason...
>
> i can't claim to grok bindkey at all.  surely someone else does.

> but bind, unlike bindkey, won't clobber your vanilla use of the bound
> key.  for example:
>
>   bind n screen telnet nethack.alt.org
>
> lets me use the 'n' key like usual (like, to type words like
> 'banana'), unless i prefix it with screen's command character (by
> default 'ctrl-a').

Ahh ok. So bind requires "command" prefix (I have set as F12), and
bindkey is where screen acts like a window manager, "consuming" that
key which has been bindkey'ed, and doing something.

I have XFCE maximise a window on F11, so F11 never gets to screen, and
F12 gets through to screen, but doesn't get to bash because screen
consumes it.

I have set up something simimilar for three levels of gnu screen -
outer, inner1 and inner2. This works well with a quick-to-press key
sequence for screen next and screen prev (I use CTRL-Pgup and
CTRL-Pgdn, like firefox) to cycle through the tabs ("screens" as
screen calls them). Then my inner1 screen uses ALT-Pgup and ALT-Pgdn
for cycling, and F9 for command. Simple to setup really.

The "disable keybind" above will allow me to have my outer screen use
an "inner1" keybinding to open up the inner screen session, and
immediately unbind that key, so it can be used by inner1 screen
session. I need that because I was running out of Fn keys :)

Thanks heaps, very convenient,
Zenaan


Reply to: