« 512 Altix SMP machine at Nasa Ames | Main | NEW SOFTWARE PORT - CROSSFIRE »

December 1, 2003

IRIX SCREENSAVERS (xscreensaver, really slick screensavers and more)

Recently I had cause to investigate the IRIX screen saver mechanisms in order to fix the desktop utility iconbar that I've been writing. I thought I'd share a bit of what I've learned (or at least think I've pieced together, corrections are welcome!) For the impatient among who you who might like to skip the long winded intro I'll cover:

- configuring xscreensaver under IRIX
- making the really slick screensavers GLX port work with xscreensaver (which includes screen locking)
- compiling the fireflies 2.06 screensaver

First off, the screen saver is implimented as an extension to X. That means it's actually the X server that starts the screen saver application whenever a certain duration of inactivity is detected. On most systems this is an extension to X call MIT-SCREEN-SAVER, under IRIX it appears to be a customized (i.e. partial ) implementation called (SGI) SCREEN-SAVER. The list of C API interfaces to setting the screensaver is provided by the commands XSetScreenSaver, XForceScreenSaver, XActivateScreenSaver, XResetScreenSaver and XGetScreenSaver. A shell command line applications that can run those commands for you is called xset.

Note: the power saving settings (on by default in IRIX 6.5) that actually turn the monitor off are not part of the screen saver extension and are set in /usr/lib/X11/xdm/Xlogin.

There are also some undocumented functions in /usr/include/X11/extensions/XScreensaver.h which include XScreenSaverQueryExtension, XScreenSaverQueryVersion, XScreenSaverEnable, and XScreenSaverDisable. I'm not sure if they are really usable or not. The only difference here versus the standard MIT extension seems to be the absence of an XScreenSaverNotifyEvent, that an application could ask to receive. Unfortunately for me, that's precisely what I was looking for for my own development effort, but that's another story.

The next link in the chain is an application called ssaver(1) (a.k.a. /usr/bin/screensaver). This is the GUI that normally gets called up by the Toolchest Desktop->Customize->Screen Saver menu item. This reads some configuration files in /usr/lib/X11/savers/defaults, takes user input, and turns them into xset commands and writes then into $HOME/.desktop-/panelsession which is in turn executed by /usr/lib/X11/xdm/Xsession.dt at the start of the user's session. Inside of panelsession is the name of the command to run for the screensaver. By design in IRIX that is either a program called xlock or haven.

Xlock is a heritage program with a limited number of hard coded demos (blank, rotor, pyro, flame, hop, image, life, pop, qix, swarm and random). It is not expandable, but it's advantage is that it locks the screen. (As a side note there is another "xlock" called xlockmore available from http://freeware.sgi.com, that offers many more hard-coded savers and is a drop-in replacement to xlock.)

Haven is the alternative to xlock and it is a more general purpose tool. It can run any program that opens an openGL window as the screensaver. This is the mechanism lisp used to add the Really Slick Screensavers to the ssaver option panel. You can get lisp's excellent patched, pre-compiled and packaged binaries at http://www.thecommune.org.uk/~lisa/programs.schtml. The unfortunate draw back of using haven, IMHO, is the lack of screen-locking ability.

That brings us to xscreensaver, which in many ways is the luxury sedan of the X screensaver world. It is: fully extendable, feature laden (it even professes to add image-file viewing/panning capabilities like the Mac, and the ability to run animations -- neither of which I've tried), readily available from http://freeware.sgi.com and locks the terminal. Unfortunately, I hadn't the foggiest idea how to configure it, and I really wanted it to use the Really Slick Screensavers. Well I finally hunkered down and learn't.

Xscreensaver runs a (background) daemon that monitors the system for inactivity. This daemon is launched via the shell command xscreensaver &. The daemon reads a configuration file, nominally $HOME/.xscreensaver, that tells it all about the various options and screensaver modules it can run. These options can also be set graphically via a GTK+ application called xscreensaver-demo which acts very much like SGI's ssaver. In order to incorporate the Really Slick Screensavers (RSS) add the following lines to your $HOME/.xscreensaver:

GL: /usr/local/bin/helios -r \n\
GL: /usr/local/bin/solarwinds -r -R 1 -g 0 -s \
65 -W 40 -p 500 -b 80 \n\
GL: /usr/local/bin/colorfire -r \n\
GL: /usr/local/bin/euphoria -r \n\
GL: /usr/local/bin/cyclone -r \n\
GL: /usr/local/bin/flux -r -g 2 -s 50 -i 40 \
-c 10 -f 2 \n\
GL: /usr/local/bin/plasma -r -s 30 -R 40 -f 50 \n\
GL: /usr/local/bin/lattice -r \n\
GL: /usr/local/bin/skyrocket -r \n\
GL: /usr/local/bin/sundancer2 -r \n\
GL: /usr/local/bin/hufo_smoke -r \n\
GL: /usr/local/bin/hufo_tunnel -r -c 0 -s \
True -t 1 \n\
GL: /usr/local/bin/busyspheres -r \n\
- GL: /usr/local/bin/fieldlines -r -i 20 \n\
- GL: /usr/local/bin/flocks -r -p 3 \n\
GL: /usr/local/bin/fireflies -r -M 5 60 \n\

The -r is a command line option supported by most screen savers programs (including RSS) that tells the app to draw on the root window, a requirement for compatibility with xscreensaver. The additional command line options are my own tweaking of the RSS applications and can be dropped. A happy coincidence is that many of the RSS programs seemed to have problems initializing their window when used with haven so that sometimes only a 1/4 full-screen window appeared or else a blank screen. By using the root window drawing option on the RSS modules, these errors have disappeared on my system!

There were two last little tricky bits in getting xscreensaver going on my system. First, if you are using shadowed passwords (and you should!) then xscreensaver needs to be setuid to root. This explained in the release notes on freeware.sgi.com.

NOTE: This product installs its X application default files in /usr/freeware/lib/X11/app-defaults, which is not in the default X search path. There are several ways to extend your X search path via environment variables, however in my opinion the easiest thing to do is create a symbolic link in /usr/lib/X11/app-defaults:

ln -s /usr/freeware/lib/X11/app-defaults/XScreenSaver

Also, if you're using shadow passwords, you'll need to make /usr/freeware/bin/xscreensaver setuid:

chmod 4755 /usr/freeware/bin/xscreensaver

This is not as dangerous as it sounds since xscreensaver absolves itself of being root as soon as it's done loading the password database. (If root ran it it tries to become nobody, otherwise it seems to go back to the executing user's id).

The next part was a bit of a bother getting the syntax correct, but to make a long story less long I added the command to start the daemon to my $HOME/.sgisession file in order to have xscreensaver active every time I logged in. In my case .sgisession looks like (all on one line)

/usr/local/bin/iconbar & /usr/freeware/bin/mozilla & /usr/freeware/bin/xscreensaver-command -exit; /usr/freeware/bin/xscreensaver -nosplash

This starts my iconbar application, mozilla and then kills any existing instances of the xscreensaver daemon and then starts a new one. I'm not sure if this the best place to put this -- it might have been better to place it in $HOME/.desktop-/panelsession instead of xlock or haven. But it works for now. See the xscreensaver man page for more info.

By the way, don't forget to disable the existing IRIX screensaver. I did this by unchecking the box in the ssaver panel and also killing the haven process already running. It might be a good item to comment it out of panelsession as well.

Lastly, I integrated xscreensaver a bit more tightly into the IRIX desktop. I did this by following the tip I found at http://www.hytti.uku.fi/~tkalliok/sgi/xscreensaver.html which basically states:

Modify your "/usr/lib/X11/system.chestrc" like this:

Modification #1
OLD line:"Start ScreenSaver" f.checkexec.sh "/usr/bin/X11/xset s activate"
NEW line:"Start ScreenSaver" f.checkexec.sh "/usr/freeware/bin/xscreensaver-command -activate"

Modification #2
OLD line:"Screen Saver" f.checkexec.sh.le "/usr/sbin/screensaver"
NEW line:"Screen Saver" f.checkexec.sh.le "/usr/freeware/bin/xscreensaver-demo"

Now the menus items will point to xscreensaver utilities rather than the IRIX defaults (you might want to save a copy of /usr/lib/X11/system.chestrc before making any changes!).

That's it. I hope I got it right -- all information subject to change, and no warranty on result!


xscreensaver misbehaves on my system in the following manner:

- xscreensaver-demo doesn't show previews in the preview panel window
- xscreensaver-demo unchecks my enabled screen saver modules when I scroll through the list
- xscreensaver seems to start if there is no mouse activity, i.e. ignores extended keyboard-only activity

Fireflies 2.06

As one last little goody I compiled the fireflies 2.06 screen saver to add to the collection. To use it just copy the binary into a directory in your path and add (assuming it's /usr/local/bin)

GL: /usr/local/bin/fireflies -r -M 5 60 \n\

to your $HOME/.xscreensaver resource file.

Feedback appreciated and welcome!

Posted by squeen at December 1, 2003 3:40 PM


hey; i know the "cpukiller" screensaver of the rotating sgi logo uses the IRIX ssaver stuff but you should add to this mighty tutorial how to make fireflies animate on teh background of the 4dwm desktop so you can work over it. I'm sure the hardware GL engine of most SGI's can definately handle it since at 1280x1024 i do it w/ a 16mb video card in linux =P

Greate article squeen and keep up the sick work on iconbar. It's really rejuvinating(sp?) IRIX imho.

PS- every think of using SVGLib for the iconbar?

Posted by: chris [flip] at December 2, 2003 6:20 AM

Thanks Chris -- hearing that some folks are using iconbar really makes the effort worthwhile.

Regarding animating the desktop background ala CPU killer, I just run any of the RSS with the -r option directly from the command line. Unfortunately, my root window is not double buffered (could/should this be changed?) so even with dual 600MHz Octane2 w/ V6, fireflies is a bit flickery (although the CPUs seem unstressed) and it gives me the willies.

Lastly, an important xscreensaver BUG update. Xscreensaver screen locking does not play nice with x2vnc -- it tries to grab the keyboard and when it fails you lose the ability to type in your password. I wonder if a newer version of xscreensaver fixes this.

Posted by: squeen at December 2, 2003 11:21 AM

well if i ever lay eyes on an Octane2 IRL i'll rewrite xscreensaver & fireflies for mips64 NASM optimization. :)

Posted by: chris [flip] at December 2, 2003 7:45 PM