gnome-screensaver-command
Control the GNOME screen saver
SYNOPSIS
gnome-screensaver-command [OPTION...]
PARAMETERS
-a, --activate
Activates the screensaver immediately.
-d, --deactivate
Deactivates the screensaver, preventing it from activating.
-p, --poke
"Pokes" the screensaver, resetting its idle timer to prevent activation for a short period without fully deactivating it.
-q, --query
Queries the screensaver's current state (active or inactive, locked or unlocked) and prints it to standard output.
-l, --lock
Locks the screen immediately, regardless of the screensaver's idle status.
-w, --wait
Waits until the screensaver is active before exiting. Useful for scripting.
--version
Displays the command's version information.
--help
Shows a help message and exits.
DESCRIPTION
gnome-screensaver-command is a command-line utility designed to interact with and control the GNOME Screensaver daemon. It provides a programmatic interface to manage the screensaver's state, enabling users to activate, deactivate, or query its status. Furthermore, it allows for immediate screen locking. This tool is particularly valuable in scripting environments, allowing for automated screen locking before leaving a workstation, preventing screensaver activation during presentations, or simply checking if the screen is currently locked. It relies on the gnome-screensaver process running in the background for its operations. While it was a core component of older GNOME desktop environments, its functionality has largely been integrated into gnome-shell and systemd-logind in more recent GNOME versions.
CAVEATS
This command requires the gnome-screensaver daemon to be running. In modern GNOME environments (GNOME 3 and later), screen locking and screensaver management are often handled by gnome-shell itself or systemd-logind, potentially rendering gnome-screensaver-command less relevant or even non-functional depending on the specific system configuration and installed components.
<B>D-BUS COMMUNICATION</B>
gnome-screensaver-command operates by communicating with the gnome-screensaver daemon using D-Bus, a message bus system. This allows it to send requests and receive status updates from the running daemon.
<B>MODERN GNOME INTEGRATION</B>
For users of contemporary GNOME desktops, gnome-shell provides native screen locking and idle management. The loginctl command from systemd (e.g., loginctl lock-session) is often the preferred command-line method for session locking, interacting with the underlying systemd-logind service.
HISTORY
The gnome-screensaver project, including gnome-screensaver-command, was a standard feature of the GNOME 2 desktop environment, providing integrated screen locking and screensaver capabilities. With the advent of GNOME 3 and the gnome-shell, much of this functionality was absorbed directly into the shell's codebase and integrated with systemd's logind service. Consequently, while gnome-screensaver-command might still exist for backward compatibility on some systems, its direct role has diminished, with newer methods often preferred for screen management.