XScreenSaver(1)

✨ XScreenSaver(1) β€” the girlies' guide ✨

okay so bestie, welcome to section 1 of the General Commands Manual πŸ’– you're about to learn all about xscreensaver-command, and honestly? it's giving "tiny little tool, absolutely iconic job." let's get into it πŸŽ€


🌸 NAME 🌸

xscreensaver-command β€” control a running xscreensaver process πŸ¦‹

like, it's the remote control for your screensaver daemon. no cap.


⭐ SYNOPSIS ⭐

xscreensaver-command [--display host:display.screen] [--help | --quiet |
--verbose | --activate | --deactivate | --cycle | --next | --prev |
--select n | --lock | --suspend | --exit | --restart | --time | --watch
| --version]

πŸ’œ DESCRIPTION πŸ’œ

the xscreensaver-command program controls a running xscreensaver(1) daemon. that's it, that's the whole vibe. it talks to the daemon that's already off doing its thing and tells it what to do πŸ’…


✨ OPTIONS ✨

xscreensaver-command accepts the following command-line options, and there are a LOT of them, so buckle up buttercup 🌈

  • --help β€” prints a brief summary of command-line options. your classic "wait what does this thing do again" moment 🫢
  • --quiet β€” only print output if an error occurs. silent treatment, but productive πŸ’€
  • --verbose β€” opposite of --quiet. Default. this is the chatty one, and yes it's the default, so it's always talking unless you tell it not to πŸ—£οΈ
  • --activate β€” tell xscreensaver to turn on immediately (that is, blank the screen, as if the user had been idle for long enough.) the screensaver will deactivate as soon as there is any user activity, as usual. it's not locking anything, it's just blanking ✨
  • --deactivate β€” this tells xscreensaver to pretend that there has just been user activity. this means that if the screensaver is active (the screen is blanked), then this command will cause the screen to un-blank as if there had been keyboard or mouse activity. if the screen is locked, then the password dialog will pop up first, as usual. if the screen is not blanked, then this simulated user activity will re-start the countdown (so, issuing the --deactivate command periodically is one way to prevent the screen from blanking.) lowkey a hack, highkey works πŸ’–
  • --cycle β€” if the screensaver is active (the screen is blanked), then stop the current graphics demo and run a new one (chosen randomly.) surprise! it's a different hack now 🎲
  • --next β€” this is like either --activate or --cycle, depending on which is more appropriate, except that the graphics hack that will be run is the next one in the list, instead of a randomly-chosen one. in other words, repeatedly executing --next will cause the xscreensaver process to invoke each graphics demo sequentially. (though using the --settings option is probably an easier way to accomplish that.) bestie it will straight up loop through them in order πŸ”₯
  • --prev β€” this is like --next, but cycles in the other direction. backwards slay πŸ¦‹
  • --select number β€” like --activate, but runs the Nth element in the list of hacks. by knowing what is in the programs list, and in what order, you can use this to activate the screensaver with a particular graphics demo. (the first element in the list is numbered 1, not 0.) ok yes it's 1-indexed, don't come for me πŸ™ˆ
  • --lock β€” tells the running xscreensaver process to lock the screen immediately. this is like --activate, but forces locking as well, even if locking is not the default (that is, even if xscreensaver's lock resource is false, and even if the lockTimeout resource is non-zero.) it does NOT care about your settings, it's locking, periodt πŸ‘‘

note that locking doesn't work unless the xscreensaver process is running as you. see xscreensaver(1) for details. so like, same-user energy required 🫢

  • --suspend β€” like --activate, but ignores lockTimeout and immediately powers off the screen without fading out. this is intended to be run just after your laptop's lid is closed, and just before the CPU halts, to lock things down quickly. no fade, no drama, just instant bye πŸ’€
  • --exit β€” causes the xscreensaver process to exit gracefully. this does nothing if the display is currently locked. warning: never use kill -9 with xscreensaver. that can leave things in an inconsistent state, and you may need to log out to repair the damage. fr fr, do not do it, that's a mess you do not want 😭
  • --restart β€” causes the screensaver process to exit and then restart with the same command line arguments as last time. you shouldn't really need to do this, since xscreensaver notices when the .xscreensaver file has changed and re-reads it as needed. it's a little redundant but it's there for you πŸ’œ
  • --time β€” prints the time at which the screensaver last activated or deactivated (roughly, how long the user has been idle or non-idle: but not quite, since it only tells you when the screen became blanked or un-blanked.) it's an approximation bestie, don't @ me ⭐
  • --watch β€” prints a line each time the screensaver changes state: when the screen blanks, locks, unblanks, or when the running hack is changed. this option never returns; it is intended for use by shell scripts that want to react to the screensaver in some way. an example of its output would be:
BLANK Fri Nov  5 01:57:22 1999
RUN 34
RUN 79
RUN 16
LOCK Fri Nov  5 01:57:22 1999
RUN 76
RUN 12
UNBLANK Fri Nov  5 02:05:59 1999

the above shows the screensaver activating, running three different hacks, then locking (perhaps because the lock-timeout went off) then unblanking (because the user became active, and typed the correct password.) the hack numbers are their index in the programs list (starting with 1, not 0, as for the --select command.)

for example, suppose you want to run a program that turns down the volume on your machine when the screen blanks, and turns it back up when the screen un-blanks. you could do that by running a Perl program like the following in the background. the following program tracks the output of the --watch command and reacts accordingly:

#!/usr/bin/perl

my $blanked = 0;
open (my $in, "xscreensaver-command -watch |") || die;
while (<$in>) {
  if (m/^(BLANK|LOCK)/) {
    if (!$blanked) {
      system ("sound-off");
      $blanked = 1;
    }
  } elsif (m/^UNBLANK/) {
    system ("sound-on");
    $blanked = 0;
  }
}

note that LOCK might come either with or without a preceding BLANK (depending on whether the lock-timeout is non-zero), so the above program keeps track of both of them. both! it's tracking both! 🧚

  • --version β€” prints the version of xscreensaver that is currently running on the display: that is, the actual version number of the running xscreensaver background process, rather than the version number of xscreensaver-command. (to see the version number of xscreensaver-command itself, use the --help option.) sneaky little distinction, iykyk πŸ”

πŸ¦‹ STOPPING GRAPHICS πŸ¦‹

if xscreensaver is running, but you want it to stop running screen hacks (e.g., if you are logged in remotely, and you want the console to remain locked but just be black, with no graphics processes running) you can accomplish that by simply powering down the monitor remotely. in a minute or so, xscreensaver will notice that the monitor is off, and will stop running screen hacks. you can power off the monitor like so:

xset dpms force off

see the xset(1) manual for more info. it's giving "turn off the lights and everyone goes home" πŸ’‘

you can also use xscreensaver-settings(1) to make the monitor power down after a few hours, meaning that xscreensaver will run graphics until it has been idle for the length of time you specified; and after that, the monitor will power off, and screen hacks will stop being run. set it and forget it, iconic behavior πŸ‘‘


🌈 DIAGNOSTICS 🌈

if an error occurs while communicating with the xscreensaver daemon, or if the daemon reports an error, a diagnostic message will be printed to stderr, and xscreensaver-command will exit with a non-zero value. if the command is accepted, an indication of this will be printed to stdout, and the exit value will be zero. so: zero = good, non-zero = something's up, keep an eye on those streams bestie πŸ’…


πŸŽ€ ENVIRONMENT πŸŽ€

  • DISPLAY β€” to get the host and display number of the screen whose saver is to be manipulated. which screen are we messing with? this one, says DISPLAY πŸ–₯️
  • PATH β€” to find the executable to restart (for the --restart command). note that this variable is consulted in the environment of the xscreensaver process, not the xscreensaver-command process. ok this one is important, it's the daemon's PATH that matters, not yours πŸ‘€

πŸ’– UPGRADES πŸ’–

the latest version of xscreensaver(1) and related tools can always be found at https://www.jwz.org/xscreensaver/ β€” go get the fresh one, always πŸ“


⭐ SEE ALSO ⭐

X(1), xscreensaver(1), xscreensaver-settings(1), xset(1)


Copyright Β© 1992-2026 by Jamie Zawinski. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.

(translation: free to use, just keep the notice, and no promises that it'll be perfect πŸ’œ)


🌸 AUTHOR 🌸

Jamie Zawinski <jwz@jwz.org>.

please let me know if you find any bugs or make any improvements. he actually wants to hear from you 🫢


and that's the whole page bestie!! πŸ’…βœ¨ this was X Version 11, version 6.15 (30-Mar-2026), straight out of the XScreenSaver(1) manual β€” now go forth and blank some screens πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from