$linuxjunkies
>

swayidle(1)

Idle management daemon for Wayland compositors that runs commands after a period of inactivity.

UbuntuDebianFedoraArch

Synopsis

swayidle [OPTION]... [TIMEOUT COMMAND]...

Description

swayidle is a lightweight idle management daemon designed for Wayland compositors like Sway. It monitors user activity (keyboard, mouse, touchscreen) and executes specified commands after configurable idle timeouts. Common uses include locking the screen, dimming displays, or suspending the system after inactivity.

Timeouts are defined as pairs of TIMEOUT (in seconds) and COMMAND. Multiple timeout-command pairs can be chained together. swayidle will execute commands in sequence as idle periods elapse, and reset all timers when user activity is detected.

Common options

FlagWhat it does
-h, --helpShow help message and exit
-C <config>Load configuration from specified file instead of default paths
-dEnable debug logging output
-S <socket>Use specified Wayland socket path

Examples

Turn off displays after 5 minutes of inactivity, turn them back on when activity resumes

swayidle -l timeout 300 'swaymsg "output * power off"' resume 'swaymsg "output * power on"'

Lock screen after 10 minutes idle, suspend after 15 minutes total inactivity

swayidle timeout 600 'swaylock -f -c 000000' timeout 900 'systemctl suspend'

Dim brightness to 10% after 3 minutes, restore to 100% on activity

swayidle -l timeout 180 'brightnessctl set 10%' resume 'brightnessctl set 100%'

Send a notification after 1 minute without user input

swayidle timeout 60 'notify-send "System idle"'

Lock screen before system sleep and reload Sway config after resume

swayidle before-sleep 'swaylock -f' after-resume 'swaymsg "reload"'

Pause media playback after 5 minutes, then suspend after 10 minutes idle

swayidle timeout 300 'playerctl pause' timeout 600 'systemctl suspend'

Related commands