termsaver and terminal-screensaver: Peas in a pod

I’m going to lump together two programs again, this time because they more or less do the same thing, and because if either one is doing their job, I won’t really be able to show them in action. Also because, given the chance, they might work well together.

Both termsaver and terminal-screensaver work as “screensavers” for your terminal, as you might have guessed by their names. šŸ™„ They each take a slightly different approach to the issue though.

A long time ago, before I rounded up my own esoteric solution to the screensaver for the console, it was clear that two problems were at work simultaneously: First, something has to sit back and watch your terminal activity and hijack it when nothing has been happening. Second, something has to restore it cleanly when you return.

The obvious solution to that is to have some sort of daemon diligently watching your terminal session, and spawning a third program when your timeout is triggered. And of course, end that program and restore your session at the press of a key.

That’s the approach terminal-screensaver takes, and it does an admirable job of doing so. I first ran across terminal-screensaver a couple of years ago, and for the most part, it worked as promised. The author has a YouTube video of terminal-screensaver at work, if you are one of those visual learners. šŸ˜‰

As I see it in my puny little nonprogrammer brain, terminal-screensaver relies on your .bashrc (or .*shrc) to trigger a daemon when you start a terminal. That daemon sits and watches your activity, and kicks in the screensaver of your choice — the default is cmatrix, but there are lots of others that could work — when it senses you’ve gone to the refrigerator.

terminal-screensaver can be a little tricky to configure; you have to get its configuration file, the daemon’s configuration file, the working directory for the daemon, your .bashrc and your $PATH all living together under one roof … which sometimes isn’t easy.

When it’s done right, it does work as promised. When it isn’t done right, you get a lot of strange messages spattered across the screen, nothing ever commandeers your terminal, and even when it does, getting it back can be a trick. So at least you’ll know if you don’t get it right. šŸ˜‰

termsaver, by contrast, expects you to trigger it directly, before you walk to the refrigerator. Here again, is the obligatory video supplied by the developers.

termsaver comes with an array of built-in screensavers, the bulk of which pull text from external sites — the list is in the --help message — and send them to the screen, typewriter-style. There are also the obligatory clock and zipping dot modes, as well as jumping random words.

A small glitch: termsaver didn’t think to set the cursor behavior, and my XP-wannabe terminal style uses a solid block cursor, which is visible as it jumps around the screen. That too is a small note, if anyone sees it.

My biggest challenge with termsaver was the fact that it doesn’t really … work like a screensaver. By that I mean that termsaver doesn’t approach the original two challenges I mentioned.

Without some external program — and I daresay terminal-screensaver would work in this case — to handle the timeout and restore issues, termsaver is just a pack of terminal gimmicks wrapped up in one program.

You can start termsaver as you get up from your desk, and you might even go crazy and set up a one-key trigger to kick it into action when the refrigerator summons you.

But it’s not watching your lack of input, not counting out the idle seconds, and so in my mind, it’s not really solving the problems of a proper, classical, terminal screensaver utility. šŸ˜¦

After looking at both of these, I still think using screen’s built-in idle function or tmux’s analogue is a better way. tmux and screen can both solve the console screensaver challenge (which I see as a step forward when compared to termsaver), and they both require only a few lines of configuration (which is less than terminal-screensaver needed).

On the other hand, if you’re not interested in using a multiplexer while you work at the command line, perhaps one of these — or both together — will push you a small bit closer to text-only nirvana. šŸ˜‰

3 thoughts on “termsaver and terminal-screensaver: Peas in a pod

  1. John

    Maybe you could get termsaver to work with something like this (and I haven’t tried it) in your .bashrc:
    if [ “${TMOUT}” = “” ]; then
    export TMOUT=300

    So the thing watching for inactivity is bash itself (if you’re OK with the screensaver never coming on if you have a long-running command going). One upside is that I added exit – now it’ll have the “lock screen” feel that someone needs to re-enter the password if the screen saver was on.

    But GNU screen’s probably still has this beat. You could launch it from your .bashrc (I do on at least one machine) and set the idle command to detach… or something. I haven’t experimented with this.

  2. Pingback: vlock: The simplest screensaver I know | Inconsolation

  3. Pingback: Bonus: A dozen more remainders | Inconsolation

Comments are closed.