gnome-session-inhibit
Inhibit system sleep, screensaver, or power management
SYNOPSIS
gnome-session-inhibit [OPTION...] [--] [REASON]
PARAMETERS
--app-id ID
Application identifier; replaces existing inhibitor with same ID
--reason REASON
Human-readable reason for inhibition (default: interactive)
--inhibit FLAG
Inhibit action: idle, logout, suspend, or switch-user (repeatable)
--session SESSION-ID
Target specific session ID (default: current)
--replace
Replace any existing inhibitor with same app-id
DESCRIPTION
The gnome-session-inhibit command requests the GNOME Session Manager to inhibit specific session behaviors that could interrupt user activities, such as automatic logout, idle timeouts, screen suspension, or user switching. It is commonly used by applications like slideshow viewers, software installers, or full-screen games to prevent the desktop session from interfering.
Without arguments, it runs interactively, inhibiting logout until interrupted (e.g., Ctrl+C), and prints an inhibition cookie ID to stdout. This ID can be used to manage the inhibitor via systemd-logind or by signaling the process.
Flags like --inhibit idle prevent the session from considering the system idle, while --inhibit suspend blocks sleep requests. Multiple inhibitions can be specified. The command is session-aware and respects D-Bus inhibitors, ensuring safe operation within GNOME environments.
CAVEATS
Requires active GNOME session manager; ineffective in other desktops. In interactive mode, inhibition ends on SIGINT or process exit.
INHIBITION COOKIE
Outputs numeric ID (cookie) to stdout for inhibitor tracking/release via logind.
EXIT STATUS
0 on success, 1 on error; inhibition persists until process ends or replaced.
SEE ALSO
gnome-session(1), loginctl(1), systemd-inhibit(1)


