old-www/LDP/LG/issue24/zawinski.html

146 lines
6.6 KiB
HTML

<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<title>xscreensaver Issue 24</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H2>xscreensaver</H2>
<H4>By <a href="mailto:jwz@netscape.com">Jamie Zawinski</a></H4>
</center>
<P> <HR> <P>
I saw the article on Xlockmore by Larry Ayers in issue 18 of the Linux
Gazette, and I was surprised that it didn't mention, even in passing,
my XScreenSaver program!
<P>
Allow me to engage in a bit of advocacy.
<P>
Back in 1991, before Xlockmore existed, there was only Xlock. Xlock
was not a screensaver: it was only a locker. There was no way to
make it activate itself automatically when the console became idle,
nor was there any way to avoid having it lock the screen: that is,
there was no way to have it turn off when the mouse moved.
<P>
So, I wrote XScreenSaver.
<P>
XScreenSaver is superior to Xlockmore in a number of ways. The most
important way, of course, is that it is actually a *screen saver*.
Although Xlockmore can be configured to not require a password, it
still doesn't have the ability to turn on when the machine is idle;
for that you have to use an external program that launches and kills
it.
<P>
The second way in which XScreenSaver is better is that it takes a
server/client approach: the "xscreensaver" program itself knows how
to detect idleness, and to lock the screen. The graphics hacks are
not built in: the beauty of XScreenSaver is that any program which
can draw on the root window can be launched by XScreenSaver for use
as a graphics hack! This has several benefits:
<P>
* You don't have to recompile and reinstall xscreensaver to
install a new graphics hack: all you have to do is change your
X resources, and issue one command.
<P>
* Since programs don't have to be written *specifically* to run
inside the xscreensaver framework, there are many more potential
graphics hacks available. They don't even need to be written in
the same language: they just have to draw on the root. Thus,
it's easier to write programs to work with XScreenSaver than with
Xlock or Xlockmore, because they don't have to follow a complex
set of idiosynchratic rules on how to structure the code: the
only rule is, "draw on the root."
<P>
* By separating the task out into two processes, the whole system
becomes more robust: the memory protection provided by the OS
serves us well, in that, if one particular graphics hack has a
bug (leaks memory, corrupts memory, gets a floating-point
exception, etc) the integrity of the screen saver itself is not
compromised. The offending hack may exit, but the screen saver
itself is still running, and the screen is still blackened (or
locked.) Also, since a screen saver is, by its nature, a very-
long-running background task, even a small leak would build up
over time. By arranging for the graphics hacks themselves to be
relatively short-running tasks, this problem goes away.
<P>
* On some systems, only programs which are running as root can check
passwords. Therefore, on such systems, a screen locker would need
to be a setuid-root program. Obviously one needs to be very
careful about what programs one allows out of the security sandbox;
a conscientious sysadmin would want to examine such a program
very carefully before installing it. The XScreenSaver model allows
this, by having the priveleged part of the program (the saver
itself) be small, while letting the larger part (the graphics
hacks) remain unpriveleged.
<P>
XScreenSaver also includes a nice Demo Mode that lets the user
interactively experiment with the currently-configured graphics hacks.
(Until recently, most Linux users wouldn't have been able to take
advantage of this, since the code had required Motif; but that is now
configurable, and demo mode works with Athena widgets too -- since
release 1.27 back in January 1997.)
<P>
If you have a system with more than one monitor, XScreenSaver can save
them both at once: a different graphics hack will run on each, and if
the two monitors have different depths (for example, if one is
monochrome and the other color) they can be configured to choose their
screenhacks from different lists, so that each monitor is running the
hacks that look best on it.
<P>
Most of the xlockmore hacks (the ones that I liked, anyway, including
the GL modes) are included with the XScreenSaver distribution; the only
change made being to extract the various display modes from the
monolithic XLock executable, and turn them into standalone
root-window-oriented programs.
<P>
However, it's possible to have XScreenSaver run xlock itself, as just
another one of its many modes -- the best of both worlds!
<P>
Do check it out: the canonical web page is <A
HREF="http://people.netscape.com/jwz/xscreensaver/">
http://people.netscape.com/jwz/xscreensaver</A>, which includes screen
shots and descriptions of most of the included graphics hacks.
<P>
The latest version, as of this writing, is 2.12. At last count, it came
with 64 different graphics hacks. Roughly a third of these were written
by me; the others were graciously contributed by others.
<P>
And, of course, it's all free, under the usual X-Consortium-style
copyright.
<P>
You also might enjoy my philosphical ramblings on the nature of
screensavers, at <A
HREF="http://people.netscape.com/jwz/gruntle/savers.html">
http://people.netscape.com/jwz/gruntle/savers.html</A>.
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1998, Jamie Zawinski <BR>
Published in Issue 24 of <i>Linux Gazette</i>, January 1998</H5></center>
<!--===================================================================-->
<P> <hr> <P>
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="./rogers.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="./lg_backpage24.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->