LinuxCommandLibrary

xscreensaver-command

TLDR

Activate screensaver immediately

$ xscreensaver-command -activate
copy
Lock screen
$ xscreensaver-command -lock
copy
Deactivate screensaver
$ xscreensaver-command -deactivate
copy
Restart screensaver daemon
$ xscreensaver-command -restart
copy
Exit screensaver daemon
$ xscreensaver-command -exit
copy
Show current status
$ xscreensaver-command -time
copy
Watch for state changes
$ xscreensaver-command -watch
copy

SYNOPSIS

xscreensaver-command [options]

DESCRIPTION

xscreensaver-command controls a running xscreensaver daemon by sending client messages. It can activate, deactivate, or lock the screen, cycle through display modes, and query status.
The -watch option streams state changes, useful for scripts that need to react to screensaver events. The -deactivate option can be called periodically to prevent screen blanking during video playback.
Configuration is done through xscreensaver-settings, which writes preferences to ~/.xscreensaver.

PARAMETERS

-activate

Blank screen immediately.
-deactivate
Simulate user activity; unblank screen.
-lock
Lock screen immediately.
-cycle
Switch to next screensaver hack.
-next / -prev
Switch to next/previous hack.
-select n
Switch to hack number n.
-restart
Restart the daemon with same arguments.
-exit
Exit daemon (fails if locked).
-time
Show last activation/deactivation time.
-watch
Print state changes continuously.

CAVEATS

Requires xscreensaver daemon running. Never use kill -9 while screensaver is active. The -exit command fails if screen is locked. X11 only.

HISTORY

xscreensaver was created by Jamie Zawinski in 1992 and has been the most popular X11 screensaver framework for decades. The modular design separates the daemon, display hacks, and control interface, allowing extensive customization and third-party hack development.

SEE ALSO

Copied to clipboard