Origami class: Fun with screen-vs

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. šŸ™„

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. … šŸ˜Æ )

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. šŸ™„ šŸ˜‰


8 thoughts on “Origami class: Fun with screen-vs

  1. Jose Catre-Vandis

    You warned them already but for ubuntu users (well ,my experience any way:

    With the default screen from the repos:

    Create a vertical split with CTRL + a then | (pipe)

    You won’t get thirds either vertically or horizontally, screen redraws to the centre

    Thanks KMandla for the updated howto on this. Such fun šŸ™‚

  2. Raichu

    Thank you very much for the tutorial, I have been very useful. BTW, I love your freaking awesome blog and all its howtos.

    Have a good day n_n

  3. Pingback: Links 17/5/2010: Firefox 3.6.4 Build 4, State Services Commission (NZ) Goes for Free Software | Techrights

  4. skingrapher

    Did you try tmux ? It’s a terminal multiplexer and I prefer it to screen, but I can’t use it on my LFS based distro system because it jumps to 100% CPU activity after 12 hours. šŸ˜¦

    You’ll find it at [url]http://tmux.sourceforge.net[/url]. I made a Pkgfile for it.

    Maybe you’ll be interested on testing it also. šŸ˜‰

    1. K.Mandla Post author

      I have, and I wanted to examine it more in the future. tmux is nice because you can adjust window sizes on the fly, instead of going through all the steps here. But it has a few downsides for me too. …

  5. gruen

    Oh, I love GNU/Screen and I use it every day. It’s such a awesome program, especially when used with ssh!

    To set the size of my windows I use the ‘resize’ command.
    Excerpt from my .screenrc keybindings:

    bind = resize =
    bind + resize +1
    bind * resize +5
    bind – resize -1
    bind _ resize -5
    bind / resize max

    When I’m in a screen window I like to make larger 5 rows (or columns) I just type:

    # *

    (I use ‘#’ as the escape key, which is very handy with my german keyboard layout. So you have to type ‘ctrl a’ instead of that!)

    BTW: Nice blog, thanks for your work! šŸ™‚

  6. Pingback: Screenshots from 120Mhz « Motho ke motho ka botho

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s