Howto: Patch and set up screen-vs

A wiser person than me once said you have to listen to what people want, and give it to them. Ordinarily I’m enough of a curmudgeon to ignore that, but in this case, it’s probably true. I attracted a little attention with that commercial for screen and the vertical split patch, and a few people asked for more detail. And I’m willing to oblige.

Two caveats. First and foremost, I am not a screen expert. screen is one of those programs I hold in high esteem because it is exceptionally customizable, especially at very low levels, and I haven’t used it enough to tackle all the intricacies and finer details. screen is great stuff though, particularly if you enjoy (?!) living life at the terminal line. Which I do, these days. 😈

Second: You will want proper framebuffer support for your system. I only mention that because I happen to use a distro that requires you to include framebuffer support, and if you don’t do it right, you’ll end up with gigantamo letters and an 80×60 screen, and won’t be happy with me. It’s also worth mentioning because in a day and age when nonstandard screen dimensions are … standard, nobody wants a 1024×768 screen smeared to fit 1280×800. In that case, I strongly recommend checking out Ali Gunduz’s note about pursuing unusual framebuffer dimensions.

All right, enough with the preliminaries. The first thing we want to do is patch screen to include the vertical split. Patching is terrifyingly easy stuff, but I’m going to do it the roundabout way, just to prove my point.

The rumors are true, Ubuntu 9.04 has the split patch in place already, it’s just that the commands are a little different from the “pure” patch. Ubuntunuts use the pipe symbol to split a screen vertically, while the vanilla version uses a capital V. Which command you use is immaterial really, since screen allows you to customize your keybindings without ever leaving the comfort of your home. Isn’t life wonderful?

Arch users have the luxury of the screen-vs PKGBUILD at their command, and so can build a version of their own design, with minimal effort. I would never dream of suggesting to a Crux user how to patch a file; Crux users inhale code as a morning ritual, and will only scoff at my pitiful efforts to enlighten them on how to patch things.

All the same I enjoy messing with stuff, so I’ll patch it in Ubuntu. First, let’s go crazy.

sudo -i

Now we can handle some of the more complicated issues without working around sudo all the time. Yes, I know, I just committed a cardinal sin in Ubuntu … sue me. If it’s that big a deal for you, don’t do it. But all the cool kids are doing it. And if you did it, you’d be really cool too. …

Next, once you’ve succumbed to peer pressure, rip out the screen that is installed. screen and screen-profiles are part of ubuntu-desktop (which is to say, a default installation). At a terminal (and if you fear the terminal, the irony is beyond me). …

aptitude remove --purge -y screen

Next let’s get screen’s source in place, along with its dependencies. apt-get is your friend here.

apt-get build-dep screen -y

If you haven’t installed it already, build-essential (which is to say, the compilation tools) will be dragged in too. Now a small dependency that may or may not give you issues later. …

apt-get install libncurses5-dev -y

I also use checkinstall, when I visit Ubuntu.

apt-get install checkinstall -y

Let’s add the source for screen. I prefer the pure, unadulterated version.


That’s just one mirror; there are lots of places you can download it from. Now decompress it.

tar zxvf screen-4.0.3.tar.gz

You should have a folder called screen-4.0.3 there now. Change into it. Now we go from crazy to barbaric: Download the patch.


Yes, I know it says 4.0.2. It works for both versions. Now bunzip it.

bunzip2 wrp_vertical_split_0.3_4.0.2.diff.bz2

Now comes the incredibly difficult, exceptionally nerve-wracking part.

patch -Np1 < wrp_vertical_split_0.3_4.0.2.diff

Tough, wasn’t it? Now let’s configure.

./configure --prefix=/usr

Customize that if you like. Check ./configure --help | less for some ideas. Now make.


And we’re one step shy of being done.


Say what you like about checkinstall; I have no opinion of it one way or another, except that it makes a nice package that I can pusharound for a few months. Now let’s check our work.


And you should get the introductory message from screen. Press a key to get beyond it. Communicate directly with screen by pressing CTRL+A, then press the question mark (?). You should see a happy help screen. With any luck, on the right is the capital V, with the vertical split command. Finished.

Okay, so now it’s in place, and we corrupted an otherwise pristine installation of ubuntu-desktop by ripping out screen and replacing it with an aftermarket part. There goes our warranty. Now let’s get it set up in such a fashion that it’s worth bragging about at work.

And this is the part where you can go really wild. Like I mentioned, one of the beautiful things about screen is that you can modify it to your heart’s delight, and no one will complain. Here’s a way to start.

hardstatus alwayslastline "%-w[%n %t]%+w%=%C %a"

shelltitle ''
startup_message off
vbell off
blankerprg cmatrix -ab -u2
idle 300 blanker

screen -t centerim 0 centerim
screen -t alpine 1 alpine
screen -t vimwiki 9 vim

Paste that into a file called .screenrc in your home directory, and restart screen. What’s it do? Well, from here and there on the Internets, I collected a few settings I like, personally. The hardstatus line sets the bottommost line of the screen as a kind of panel, with the active application selected, and a clock in the bottom right corner. The number of options you have at your disposal there is mind-boggling, check screen’s man pages for more codes.

The shelltitle variable allows you to preset the name of new screen sessions to … whatever, and I usually prefer just a blank. Otherwise, the hardstatus line will show “bash”, if I remember right.

startup_message controls whether or not the startup message is displayed. As you might have guessed. 🙄

vbell is the visual bell, which I turn off, mostly because the entire screen flashes in reverse, which is rather like being hit squarely in the center of your forehead with a ball-peen hammer. I don’t recommend that.

blankerprg and the idle command I mentioned here; I strongly recommend cmatrix in that role, or perhaps cacafire, if you’re so inclined. Be aware that libcaca in some distros requires some of X’s baggage, which I only mention if you’re a purist like me, and you’re running free of anything from Xorg, et al.

The remaining commands spawn processes and add titles to the windows, as they are begun. The last one in the list will be the window you see when screen is done starting, so if you like to start a music player or check your e-mail first of all, put it last.

Aside from what you see there, you can dig up about a bijillion other settings and commands, all of which will customize screen to the nth degree. Experiment, and report back. I love new ideas.

So what’s left? Well, the fun part really. You’re probably wondering how screen behaves and how to get a third of the screen partitioned off, like I did in the photo. It’s easy really, if you can think about the layout at all.

Every time you split a window, screen evenly divides the space to accommodate. But if you subtract a window, depending on its place in the stack, the released area is reallocated one way or another, but not evenly. That means you can work in thirds or quarters of your screen at one time, simply by adding (with CTRL+A CTRL+S or CTRL+A CTRL+V), then subtracting (with CTRL+A CTRL+X) the appropriate portion. Remember that you can bounce between “windows” with CTRL+A TAB; the cursor shows which “window” you’re in.

It might take a little practice to predict how screen will arrange things. But, if you split the screen first horizontally, then split the bottom one vertically in half, then bounce back to the top and split it vertically three times, then X-out one of the leftmost “windows,” you can run mplayer (thank goodness for the -really-quiet option 😯 ) and come up with something like this.

It also means applications that work well in single lines or restricted spaces have an excellent role in the grand scheme of things. You can arrange one slender bit of a window at the top or bottom, run a network monitor there alongside a system profile or a chat box, or e-mail client or … oh good grief. You figure it out. (I dig images and pictures of wacky arrangements, by the way. If you get one you’re proud of, by all means share.)

Anyway, that’s about all I have at the moment. This little essay is skeletal at best, considering the potential screen has, and the fun of the vertical and horizontal splits. More information is out there; tell us what you find. 😀


23 thoughts on “Howto: Patch and set up screen-vs

  1. fuxter

    i’m getting better and better with all these thing. thanks to you. )
    i got screen and dvtm
    i got elinks for browsing, mocp for music and streamed radios.
    i got mplayer for videos and even some streaming media.
    in the ‘sidebar’ i got sshed window monitoring rtorrent on my wireless router.
    and moreover in the ‘sidebar’ i got freetalk for talking with my girlfrien through gmail accounts.
    some things are not perfect yet:
    * had to add myself to video group for mplayer to work with /dev/fb0 (ubuntu’s strange staff)
    * elinks is not configured yet for my taste (ie didn’t figured how to spawn mplayer with the link, not downloaded file)
    * fbi no working in screen and dvtm (nofixes and WONTFIX status). but fortunately zgv works for images well.
    * i really stuck with 800×600. don’t have the guts to start messing with uvesa to set my native 1024×600. (at least setting 12×6 font help a little)

    just to practice downloaded NanoWarrior album from jamendo with the help of remote rtorrent, mounted smb share and listend it with great pleasure (btw i got my small album there, search “fuxter” if you would).

    it is so cool i can do almost all day-to-day tasks in that cool K.Mandla style.

    maybe a screenshot later

    1. falst

      There’s no need to mess with uvesafb drivers, in Arch you just need to add ‘options i915 modeset=1’ to /etc/modprobe.conf and add intel_agp i915 to the MODULES list in /etc/rc.conf. If you’re using ubuntu, which you seem to be, then i think it’s as simple as adding intel_agp i915 to /etc/modules and then making a file containing the string ‘options i915 modeset=1’ in /etc/modprobe.d/. There might be some issuses with how to do it in ubuntu, as I haven’t tested it :).

  2. K.Mandla Post author

    Great! I know elinks has some provisions for file associations; if you get the two to hand off a link automatically, let me know how you did it. As far as fbi working within screen, it might not; fim (I don’t use fbi) just “paints” over top of the framebuffer, so it doesn’t really work “inside” screen. fbi is probably the same.

    Other than that, someone else might have some tips for you.

    1. fuxter

      as i found in some huge and greate elinks manual, i had to reconfigure elinks with these lines in ~/.elinks/elinks.conf
      set mime.type.image.png = “image_viewer”
      set mime.type.image.jpg = “image_viewer”
      set mime.type.image.jpeg = “image_viewer”
      set mime.type.image.gif = “image_viewer”
      set mime.handler.image_viewer.unix.ask = 0
      set mime.handler.image_viewer.unix.block = 1
      set mime.handler.image_viewer.unix.program = “zgv -Az %”
      so, whenever i hit Enter on an image on this blog i get the linked image opened full-screened and played as animation be it a gif.
      don’t know how to pass a link to mplayer yet. maybe it has something to do mailcap.
      also, forgot to mention, the ‘sudo -i’ joke just killed me

  3. Peter

    Screen with the VS patch built in is not just in the Ubuntu repositories, it is also downstream in Debian. As with Ubuntu the “pipe” symbol does the magic.

  4. Higor

    I installed screen-vs from AUR but for some reason screen crashes
    after a few minutes, leaving some error about a fifo not found at

  5. Peter

    I’ve never much messed with the split screen options (vertical or otherwise) until this article prompted me to have a play.

    Two things are bugging me about the the split screen options

    1: The colour and thickness of the line dividing the different sections of the screen.

    2: That an additional status line (over above what I have defined in my screenrc is added.

    Anybody know of a quickfix for these issues?

    Screenshot so you can see what I’m talking about is available at

    My screenrc

    startup_message off
    defscrollback 5120
    vbell on
    # remap screen Ctrl-a function to Ctrl-z
    escape ^zz

    # erase background with current bg color
    defbce “on”
    term “screen-256color”

    # set every new windows hardstatus line to somenthing descriptive
    defhstatus “screen: ^En (^Et)”

    hardstatus alwayslastline
    hardstatus string ‘%{= kg}[%= %{= dg}%-w%{= gW}%n %t%{-}%+w %-= %{g}][%{Y}%c %D %d-%m-%Y%{g}]’

    #caption always “%{= dg}%-w%{= gW}%n %t%{-}%+w %-= ”
    # Default screens
    screen -t Top 0 htop
    screen -t SDF 1 ssh ***

    1. K.Mandla Post author

      I’m not sure, Peter. One of the things I found unattractive in Ubuntu’s rendition of screen was that thick vertical separator, and adjusting it is something perhaps only Ubuntu users, or perhaps Ubuntu users who have peered into the source changes, can help with.

      This is a wild shot in the dark, but is there any chance rebuilding it from scratch might give you ideas for changing some of those things?

      1. Peter

        Having read through the documentation there does not appear to be any way for the user to adjust the “thick vertical separator” so I guess I will have to try building from source.

        (NB: It’s Debian not Ubuntu :P)

  6. Pingback: Twitted by genus

  7. Pingback: Howto: Desktop “widgets” for the console « Motho ke motho ka botho

  8. Pingback: Changing the GNU Screen Highlight Colour « Inane Bits

  9. Pingback: Ubuntu 9.10 at 120Mhz, 80Mb « Motho ke motho ka botho

  10. Pingback: Rounding out a terminal-based Debian system « Motho ke motho ka botho

  11. Pingback: Origami class: Fun with screen-vs « Motho ke motho ka botho

  12. Pingback: fbterm: Birth of the cool for the console « Motho ke motho ka botho

  13. Pingback: screen’s competition: tmux « Motho ke motho ka botho

  14. Pingback: A Debian server at 150Mhz, 32Mb « Motho ke motho ka botho

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

Leave a Reply

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

You are commenting using your 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