I use screen in a Ubuntu server.

I have my screen splited in four regions each showing a different window.

The problem is when i detach (or maybe reattach) a get the four windows but only one region and i have to make C-a S all over again?

How can i keep my screen splitted when a reattach?

link|improve this question
feedback

4 Answers

up vote 5 down vote accepted

From the screen FAQ:

(The implied question being, “How do I keep my split windows over a detach?”)

The short is answer is that you can't. The longer answer is that you can fake it.

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
link|improve this answer
feedback

It seems that tmux does. This is a new multiplexer project, inspired by screen, but coded from scratch and under a BSD license.

(Sorry if my English is uncomfortable to read :-°)

link|improve this answer
feedback

In git version, new feature layout was introduced.

from screen(1):

layout new [title]

Create a new layout. The screen will change to one whole region and be switched to the blank window. From here, you build the regions and the windows they show as you desire. The new layout will be numbered with the smallest available integer, starting with zero. You can optionally give a title to your new layout. Otherwise, it will have a default title of "layout". You can always change the title later by using the command layout title.

even if you detached screen session, layout has remember how region was split.

for example, screen start with follow configuration.

layout new
split
split -v
screen 0
focus next
screen 1
focus bottom
screen 2
detach

And reattach this session, you will able to come back into (last selected) layout which has 3 splitted region.

link|improve this answer
feedback

I've read the whole screen man recently, and there's no common way to do it if screen itself can't remember it automatically.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.