screen-users
[Top][All Lists]
Advanced

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

Re: Run commands from .screenrc in reattach mode


From: Phil!Gregory
Subject: Re: Run commands from .screenrc in reattach mode
Date: Tue, 8 Mar 2005 23:42:20 -0500
User-agent: Mutt/1.5.6+20040907i

* izo <address@hidden> [2005-03-08 19:18 -0500]:
> I have screen running in split mode with 4 windows.  When i reattach
> instead of having all 4 windows displayed in a split mode i'm getting
> single window.

Yes, that's a limitation of screen.  There's a hack to preserve your
splits, though:

Splits are a property of your display.  The process managing your screen
session doesn’t really know about them; only the single process that’s
displaying the session does.  Thus, the screen session can’t remember the
splits because it doesn’t know about them, and once you detach, the
process that did know about them has exited.

The hack is to use nested screen sessions.  Start one session and give it
some escape sequence that you won’t use much (or just disable its escape
character completely).  Bind your usual detach key sequence to this screen
session.  Now, start or attach to your main screen session.  All of your
work will be done in the inner session, and you can split your
display. When you detach, however, it will be the outer session that
detaches, so your splits in the inner session will be preserved.

Assuming you use the default escape character, C-a, your alternate
screenrc should contain:

  escape ""
  bindkey ^ad detach

> Is there a way of executing .screenrc in -x or -r mode?

Your .screenrc is read every time you attach, but screen ignores many of
the commands if it's not creating a new session.

> If not is there a way of running "source" command automatically in -x or
> -r mode?  Any help would be greatly appreciated.

There doesn't appear to be; running screen commands from the command line
(-X option) takes precedence over multi attaching (-x) and changes the
meaning of the -r option.  The best approach I can think of would be
writing a wrapper script for screen to do it.  (Though if it's just
preserving your splits, use the hack above.)

-- 
...computer contrarian of the first order... / http://aperiodic.net/phil/
PGP: 026A27F2  print: D200 5BDB FC4B B24A 9248  9F7A 4322 2D22 026A 27F2
--- --
Killing children willy-nilly can also be bad since it leads to zombies (I
think).
                       -- Mike Moran, in a (void) discussion about Unix
                          processes.
---- --- --




reply via email to

[Prev in Thread] Current Thread [Next in Thread]