Site Tools


Region Management in screen

Basics

screen allows you to split the display into multiple regions and display a different window in each region. (You can also, of course, display the same window in more than one region.)

Use C-a S to split the display horizontally and C-a | to split the display vertically. When you create a new region, screen resizes the other regions in the same column (for horizontal splits) or row (for vertical splits) so that all of them have approximately the same size.

:!: Note about vertical splits:

Vertically-split regions are a feature not in the last stable release of screen; they're available in the Debian and Ubuntu screen packages and the current screen development code. They will be in the next release.

To remove regions, you can either use C-a X to remove the current region or C-a Q to remove all regions except the current one.

Extras

Resizing Regions

Resizing is done via the resize command. Without an argument, it will prompt for the new height of the current region. A plain numeric argument will resize the region to the specified number of lines. A numeric argument with a leading + or - will add or subtract the specified number of lines from the region. An argument of “min” will reduce the region's height as much as possible (generally down to one line high). An argument of “max” will increase the region's height as much as possible (generally reducing the height of the other regions in the column to one line). Finally, an argument of = will adjust the height of all regions in the display so that all regions in a given column are of roughly equal height.

As a special case, if the resize command is issued from a vertically-split region–that is, a region that does not have any other regions in its column–all of the sizing applies to regions' widths, not their heights. Be careful when narrowing regions! The amount of text you can type into screen's command line is limited to the width of the current region.

When a region is shrunk, it adds space to the region either below it or to its right (depending on whether its height or width is being decreased). When a region is expanded, it takes space away from the region either below it or to its right. If the immediately adjacent region is a small as possible, space is taken from the next closest region in the same direction. If every region in that direction is as small as possible, space is taken from the closest region in the opposite direction that can spare it.

Focusing Regions

The focus command is relatively simplistic. Even though regions may be laid out in a two-dimensional space, screen maintains them internally as a simple list, and focus simply moves forwards or backwards through the list. (There are also focus subcommands to jump to the beginning of the list–the upper-leftmost region–and to the end of the list–the lower rightmost region.) The order is pretty intuitive, and it's easier to tell you to try it out than to try to describe it.

Regions as a Display Property

One thing that catches some people unawares is that the division of the display into regions is solely a property of the display. The screen session that hosts all of your windows doesn't know how the display was split. This has the consequence that as soon as you detach from a screen session, the layout of regions on your display is lost; the next time you attach, you'll have to recreate that layout.

Currently, the best way to keep your display layout is to use nested screen sessions, as described in the FAQ entry when I split the display and then detach, screen forgets the split. The next release of screen will have new commands to save and restore region layouts.

Keybindings

  • C-a tab - switch input focus to the next region.
  • C-a Q - remove all regions but the current one.
  • C-a S - split the current region horizontally into two new regions.
  • C-a X - remove the current region.
  • C-a | - split the current region vertically into two new regions.

Commands

  • focus - Moves input focus between regions.
  • only - Removes all regions except the current one.
  • remove - Removes the current region.
  • resize - Resizes the current region.
  • split - Splits the current region into two new regions.

User Tools