λ

swayaway

a drop-in replacement for swayidle(1)

settings

swayaway.1.scd

3991 bytes raw

swayaway(1)

# NAME

swayaway - idle manager for Wayland

# SYNOPSIS

*swayaway* [options] [events...]

# OPTIONS

*-C* <path>
	path to the config file. by default, the following paths are checked
	in order:

	. $XDG_CONFIG_HOME/swayaway/config
	. $HOME/.config/swayaway/config
	. $HOME/.swayaway/config
	. $XDG_CONFIG_HOME/swayidle/config
	. $HOME/.config/swayidle/config
	. $HOME/.swayidle/config

	so an existing swayidle config works unchanged. config lines are the same events as the command line; _#_ starts a comment and shell expansion applies (quote commands with spaces: timeout 300 "swaylock -f"). specifying events in the config and as arguments is not mutually exclusive.

*-d*
	debug output.

*-w*
	wait for commands to finish before continuing. useful with *before-sleep* and swaylock *-f*, so swaylock has actually locked the screen before the system goes to sleep. note that this blocks until the command finishes.

*-S* <seat-name>
	pick a specific seat. by default, if no name is specified, an arbitrary seat is picked instead.

*-h*
	show help message and quit.

# DESCRIPTION

swayaway is a drop-in replacement for swayidle(1). it listens for idle activity on your Wayland compositor and executes tasks on various idle-related events. you can specify any number of events at the command line and in the config file.

the only dependencies are libwayland-client and libdbus-1; there is no elogind dependency and no libsystemd.

it exports _org.freedesktop.ScreenSaver_ (plus the _org.gnome.ScreenSaver_ alias) on the session bus, so browsers, media players, and any other app that calls Inhibit()/Uninhibit() can suppress idle timeouts.

it also listens for logind's _PrepareForSleep_ signal to run *before-sleep* / *after-resume* commands. if no logind is running, these events simply never fire.

idle detection also respects Wayland-level idle inhibitors (_zwp_idle_inhibitor_v1_), exactly like swayidle's default.

# EVENTS

*timeout* <timeout> <timeout command> [resume <resume command>]
	execute _timeout command_ if there is no activity for <timeout> seconds. if you specify "resume <resume command>", _resume command_
	will be run when there is activity again. this is the swayidle 1.8+/1.9 syntax.

	the legacy mode syntax `timeout N resume CMD` (pre-1.8) is also accepted; the command then runs on timeout *and* on resume.

*resume* <command>
	legacy top-level event; runs _command_ on every activity.

*before-sleep* <command>
	executes _command_ when logind signals that the computer is about to sleep, before the sleep is allowed to proceed.

	note: this only delays sleeping up to the limit set in *logind.conf*(5) by the option InhibitDelayMaxSec. a command that has not finished by then will continue running after resuming from sleep.

*after-resume* <command>
	executes _command_ after logind signals that the computer resumed from sleep.

swayidle's *lock*, *unlock* and *idlehint* events go through the logind Session interface and are *not* supported; swayaway rejects them with an error, same as swayidle built without systemd/elogind.

all commands are executed in a shell.

# SIGNALS

swayaway responds to the following signals:

*SIGTERM, SIGINT*
	run all pending resume commands. when finished, swayaway terminates.

*SIGUSR1*
	immediately enter idle state.

# EXAMPLE

```
swayaway -w \\
	timeout 300 'swaylock -f -c 000000' \\
	timeout 600 'swaymsg "output * power off"' \\
		resume 'swaymsg "output * power on"' \\
	before-sleep 'swaylock -f -c 000000'
```

this will lock your screen after 300 seconds of inactivity, then turn off your displays after another 300 seconds, and turn your screens back on when resumed. it will also lock your screen before your computer goes to sleep.

to make sure swayaway waits for swaylock to lock the screen before it releases the logind sleep lock, the *-w* option is used in swayaway, and *-f* in swaylock.

# SEE ALSO

*sway*(5) *swaymsg*(1) *sway-input*(5) *sway-output*(5) *sway-bar*(5) *loginctl*(1)