swayidle
Manage idle state and trigger actions
TLDR
Listen for idle activity using the configuration in $XDG_CONFIG_HOME/swayidle/config or $HOME/swayidle/config
Specify an alternative path to the configuration file
SYNOPSIS
swayidle [OPTIONS] -w EVENT_TYPE COMMAND... [-w EVENT_TYPE COMMAND...]...
PARAMETERS
-w, --wait
The primary option used to define a rule. It must be followed by an event type and its associated commands or actions. Multiple -w flags can be used to define various rules.
timeout <seconds> <command>
An event type. Executes command after seconds of user inactivity. The command can be any shell command or the special dpms action.
resume <command>
An event type. Executes command when user activity resumes, specifically after a timeout command has been triggered and potentially put the screen to sleep or locked it. This must follow a timeout rule.
lock <command>
An event type. Executes command when the screen is locked (e.g., by swaylock).
unlock <command>
An event type. Executes command when the screen is unlocked.
before-sleep <command>
An event type. Executes command just before the system enters a sleep or suspend state.
after-lock <command>
An event type. Executes command immediately after the screen has been successfully locked.
dpms <on|off>
A special swayidle action keyword that can be used as a 'command' within timeout or resume rules. It controls Display Power Management Signaling for all outputs, turning them on or off.
-v, --version
Displays the version information of swayidle.
-h, --help
Displays a help message with usage instructions and available options.
DESCRIPTION
swayidle is a daemon designed for the Sway Wayland compositor, allowing users to define actions that are triggered after periods of user inactivity. It integrates with the Wayland idle protocol to detect when the user has not interacted with input devices (keyboard, mouse, touchpad). Common uses include automatically locking the screen, turning off displays, or suspending the system after a specified idle duration.
It supports different idle states (idle, locked, screen-off) and allows chaining commands. For example, one might configure swayidle to lock the screen after 5 minutes of inactivity and then turn off the display after an additional 5 minutes. This makes it a crucial component for power management and security in a Sway environment.
CAVEATS
swayidle requires a Wayland compositor that implements the idle protocol (like Sway). All commands specified are executed via sh -c, meaning they run in a subshell. Users should be careful with commands that might block or run indefinitely, as they could interfere with swayidle's functionality or the system's responsiveness.
COMMAND EXECUTION CONTEXT
All commands specified with swayidle are executed through sh -c. This implies that standard shell features such as pipes (|), redirections (>, <), and backgrounding (&) can be utilized within the command strings, offering flexible scripting capabilities for idle actions.
CONFIGURING MULTIPLE RULES
swayidle is designed to handle multiple rules concurrently. Users can define various timeout rules with different durations and commands, as well as combine them with lock, unlock, before-sleep, and after-lock events. This allows for sophisticated and layered idle management configurations tailored to specific user preferences and security requirements.
HISTORY
swayidle was developed as an integral part of the Sway Wayland compositor ecosystem. It fills the role of idle management previously handled by tools like xautolock or xidle in Xorg environments, but adapted for Wayland's distinct architecture and security model. Its development is tightly coupled with Sway, aiming to provide a complete and native Wayland experience for desktop users by addressing essential power management and security needs.