Skip to main content

GNU screen: A Graphical Replacement

GNU screen is an essential application, yet its learning curve is insanely steep. Even everyday users barely scratch the surface of what it can do due to lack of knowledge. Neither the defaults (e.g. no caption by default) nor the interface (e.g. tons of special key combinations that hopefully don't conflict with your existing applications) make things any easier. I've been thinking a lot about how to improve it.

Imagine what you could do if you were to use a GUI for some cool new version of screen. Now I know that there's a real benefit to the way screen works in that all you need on the client side is a terminal, and I'm sure many a GUI hater will think I'm missing the point of screen. Let's face it though, I do have a graphical desktop. Furthermore, I'm not talking about getting multiple terminals on the local system. Tabbed terminals solve that trivially. I'm talking about multiple terminals running on a remote system that may or may not be prone to sudden HUPs. Ideally, the GUI client could make things a lot more user friendly. Here's how you use screen:
(multiple ptys) <-> screen <-> ssh <-> your terminal
You type commands into your terminal, and screen does something with them. Sometimes the commands influence screen itself. Other times, screen passes them onto the active pty. Now, imagine an improved graphical version of screen. For the time being, I'll call it scrim, SCReen IMproved:
(multiple ptys) <-> scrim server <-> ssh <-> scrim client <-> (multiple GUI terminals, such as gnome-terminal)
Note that you now have 4 windows on the client, the scrim client and the 3 terminal applications. Perhaps you might use a terminal that supports tabs to consolidate the 3 terminals. Since the scrim client has its own window, it can be really easy to use, and there are no keybinding conflicts. The terminal applications each act like separate terminal sessions. A lot of multiplexing is going on between the scrim server and scrim client. There's a "tunnel" for each terminal, and a "tunnel" for the server and client to talk about configuration. Nonetheless, you can still close the scrim client and reconnect later without loosing anything. I'm not really proposing anything new except to say that an interface that's more like Remote Desktop could make using screen a lot more pleasant and reduce the learning curve.

Now, if I only had the time and intelligence to code it :) It makes me wonder how hard it would be to do something like this, writing the client and server in Python. Naturally, the server must be very standard, and there may be multiple clients for say, KDE, GNOME, OS X, etc. Specifically out of scope is dealing with any terminal code myself. Terminals are not for the faint of heart, and I think it's possible to just connect the two pty's and let terminal software do the hard work.

If you know of such an existing application, please tell me.

Comments

For maximum portability to servers you may not have much control over, it makes sense to have a version of the scrim server written in C. Perhaps it can even be a statically built binary. The client can be written in whatever language makes sense for GUI development. Perhaps a Python client and server can be built as reference implementations. At some level in the protocol, JSON can be used to transport rich data in a language independent manner. Perhaps the lower level protocol is based around length:data in order to support the multiple streams needed. However, the particular stream devoted to transmitting configuration data could use JSON. One thing to remember is that no matter what you do, we're not talking about TCP, we're talking about a pty connection, for instance SSH.
You're not the only one to have the exact same idea. I found your blog by searching for "gui gnu screen replacement" on google.

No luck so far, but stay tuned. I realize that it's at least 64000 times too much data to do it this way, but I like VNC for this purpose: You remotely connect even to a graphical desktop and then open up terminals in it. Then, when your internet connection hiccups, your bit-torrent downloads, or whatever, are not interrupted.

Warren
Anonymous said…
I'll be the proverbial GUI hater here and just say you're missing the point. :)

Seriously, screen within screen. Just ssh to the remote server and start screen. This is what I do; I just have different command keystrokes for the remote server (typically the standard C-a for local, and C-t for remote). It works out pretty easy. And I don't lose the advantages that screen gives me: low bandwidth, remotely usable, detachable, etc. etc.

My only real complaint with screen is that every few weeks or months it crashes due to some weird terminal redraw. If it were more stable, or it ran windows in subprocesses, that would be ideal for me. (In fact, I already do this for a couple of windows using dtach.)
Here's how it would work. There's something on the remote server that's running. Right that, that's screen. However, in my world, it's something lower level. Locally, you can run a GUI. A GUI with menus is very easy to use, however, it has all the same power as screen because it's controlling the remote process. Furthermore, all the bandwidth considerations are the same.
I just stumbled across this today:

"tmux is a terminal multiplexer: it enables a number of terminals (or windows), each running a separate program, to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached."

The screen shots are pretty: http://tmux.sourceforge.net/
I looked a tmux a bit. I'd say it's worth using on a remote system, but less so for your desktop. Terminals are a pain, and even tmux can't fix all their problems ;)
Anonymous said…
tmux is very much worth using on your local machine. Ever have a program you want to run in the background and not see until you want it? Get sick of having 10+ terminals open? I run a program called pianobar (to play pandora music without flash...) in tmux, detach it and get to listen to music without having an extra terminal cluttering my desktop.
Shannon Behrens said…
Hmm, I use tabs for that, although I'm sure tmux is lovely.