Starting and stopping xscreensaver with Openbox

Now that I have the whole pipe menu thing worked out, I’ve got a better handle on how to manage external applications with Openbox. The xscreensaver wallpaper trick (which I have to admit, I adore now) has been my guinea pig for this one, but you can adapt it to your use.

In Arch, the screensaver executables are in /usr/libexec/xscreensaver/, which I mentioned earlier. The problem is that there are just too darn many — more than 200 — and probably two-thirds of them won’t run on this machine.

So I set up a hidden directory in my home folder called .libexec/xscreensaver/, and I’ve copied the ones I like to there. The script searches the directory and outputs the startup command with a -root flag embedded in xml tags.

Rather than fight WordPress to get the code right, I’ve pasted my script into the Arch pastebin here.

The exciting part of that script — where the label is formed — is from the aforementioned Gentoo forums post that I used as the basis. I think that was why none of my pipe menus worked before: I had illegal labels.

I also put a “Stop screensaver” command at the top of the script. One screensaver doesn’t bump the other one when it starts. In other words, two screensavers will try to run at the same time, and I haven’t found a universal flag to tell one screensaver to replace anything else that’s running.

As an additional crinkle, each screensaver has a unique name, so I can’t screen them out with a kill command.

So to prevent a system lockup by running two screensavers simultaneously, I have a pkill -f trigger that stops anything with “xscreensaver” in its command line. That should be just screensavers, but if you’re running something different on your machine, it’s worth double-checking. You could, I suppose, screen out active screensavers with a unique folder location, and pkill the name of the folder, since it’s probably part of the command.

For what it’s worth, a lot of these screensavers bog down a 300Mhz machine. Thus far, my favorites are coral, goop, deco, popsquares, whirlwindwarp and wormhole. Most of the other ones need OpenGL, or are just too taxing for my setup.

1 thought on “Starting and stopping xscreensaver with Openbox

  1. m2h

    You can control how much CPU usage the xscreensaver uses.
    I use Euphoria as my wallpaper under Gnome. I have it set to using it’s grid lines (wireframe) option. System monitor will show it always using less than 1% CPU usuage.

    Here’s my command.

    /usr/lib/xscreensaver/euphoria -n -r -x 30 –grid -d 10

    Reply

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