Time for some good, old-fashioned, knuckle-popping keyboard gymnastics. For a little while now I have been wanting to discuss how to wrangle screen with the vertical split patch, and fold it into unusual shapes, like this.
Granted, at 800×600, that’s a bit of an eyeful. And setting it up can be a rather tricky process. I tried to explain it a little bit here, when I talked about building screen-vs, but it can take a little getting used to, and isn’t always intuitive.
Before I go any further, I should say that your screen might act differently than mine, depending on the distro and how it was built. If you find that these instructions don’t quite match how your version of screen is behaving (I’m looking at you, Ubuntu users), then you should consider building it from scratch, from the source package. It’s an easy thing to do, and to be honest, screen’s vanilla behavior is a lot more likeable than some of the variations I’ve seen.
To start, open screen and give yourself a few windows to play with. What you run in them isn’t important, but try to pick applications that won’t crash when resized, or don’t need a particular dimension to be happy. :roll:
Now jump to an open window and press CTRL+a S. That’s a capital S.
Nice. A simple horizontal split. Do it once more, and you should have three strips running horizontally.
That’s the basis of creating a new layout: Split the window, and screen evenly divides the space that’s available. Now jump to the second, central strip by pressing CTRL+a TAB. Then press CTRL+a X. That’s a capital X.
CTRL+a X removes windows from the arrangement, and since the previous window is occupied, it spills into the removed space. However, screen didn’t reallocate the space to make an even split, so the bottom third of the screen is still a separate space.
And that’s basically how the magic happens. Since screen doesn’t automatically redraw everything evenly, you can shift and partition spaces in any depth or width you like, by repeatedly splitting it down to the size you like, and then subtracting out portions.
Let’s keep going. Now press CTRL+a V, and then again. That’s CTRL+a, followed by a capital V, then the same sequence again.
Now the top two-thirds of the screen is split into thirds vertically. Now we repeat the same thing we did a few seconds ago: Press CTRL+a TAB to jump to the next window, then press CTRL+a X to remove it.
Now we’ve got a nice neat postage stamp effect happening here, where the upper left two-thirds of the screen — both horizontally and vertically — are partitioned off in a space proportional to your native screen dimensions.
There’s no rule that says we can’t further split these windows, beyond what we’ve done already. Press CTRL+a TAB once more to enter that last vertical third, then press CTRL+a S again, to split that one horizontally again.
Be aware that you might see a few screen artifacts here and there; nothing is perfect, but they should disappear or be overwritten as you use the windows. If not, file a bug report against screen, or the patch, or both. ;)
What to do with those little teeny spaces? Well, clocks are fun to have in there, or mail notification tools, or even small disk space monitors or remote windows. (Run screen over ssh inside screen … it boggles the mind. … :shock: )
One more split and we’ll be done. Press CTRL+a TAB twice to jump to the bottommost horizontal third, and then split that vertically with CTRL+a V. It’s hard to see, but that will give you halves in that bottom third … sixths?
So what’s left? Pop windows into place as you like.
The only bad part of this system is if you make a mistake, you have to start from scratch (press CTRL+a Q to recover the entire screen and start over). In some cases it may behoove you to make sure you allocate certain parts first — for example, start up mplayer, then arrange the screen vertically to fit its depth, then partition the rest of the screen. Work smart, not hard.
But that’s all there is to it. Try a few different arrangements, and see what kind of results you get. If you find something particularly lovely or space-conscious, please feel free to share it.
Next up, how to make a balloon giraffe out of ed and a pair of 16Mb SIMM chips. :roll: ;)