swayaway
a drop-in replacement for swayidle(1)
swayaway.1.scd
3991 bytes raw
1swayaway(1)
2
3# NAME
4
5swayaway - idle manager for Wayland
6
7# SYNOPSIS
8
9*swayaway* [options] [events...]
10
11# OPTIONS
12
13*-C* <path>
14 path to the config file. by default, the following paths are checked
15 in order:
16
17 . $XDG_CONFIG_HOME/swayaway/config
18 . $HOME/.config/swayaway/config
19 . $HOME/.swayaway/config
20 . $XDG_CONFIG_HOME/swayidle/config
21 . $HOME/.config/swayidle/config
22 . $HOME/.swayidle/config
23
24 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.
25
26*-d*
27 debug output.
28
29*-w*
30 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.
31
32*-S* <seat-name>
33 pick a specific seat. by default, if no name is specified, an arbitrary seat is picked instead.
34
35*-h*
36 show help message and quit.
37
38# DESCRIPTION
39
40swayaway 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.
41
42the only dependencies are libwayland-client and libdbus-1; there is no elogind dependency and no libsystemd.
43
44it 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.
45
46it also listens for logind's _PrepareForSleep_ signal to run *before-sleep* / *after-resume* commands. if no logind is running, these events simply never fire.
47
48idle detection also respects Wayland-level idle inhibitors (_zwp_idle_inhibitor_v1_), exactly like swayidle's default.
49
50# EVENTS
51
52*timeout* <timeout> <timeout command> [resume <resume command>]
53 execute _timeout command_ if there is no activity for <timeout> seconds. if you specify "resume <resume command>", _resume command_
54 will be run when there is activity again. this is the swayidle 1.8+/1.9 syntax.
55
56 the legacy mode syntax `timeout N resume CMD` (pre-1.8) is also accepted; the command then runs on timeout *and* on resume.
57
58*resume* <command>
59 legacy top-level event; runs _command_ on every activity.
60
61*before-sleep* <command>
62 executes _command_ when logind signals that the computer is about to sleep, before the sleep is allowed to proceed.
63
64 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.
65
66*after-resume* <command>
67 executes _command_ after logind signals that the computer resumed from sleep.
68
69swayidle'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.
70
71all commands are executed in a shell.
72
73# SIGNALS
74
75swayaway responds to the following signals:
76
77*SIGTERM, SIGINT*
78 run all pending resume commands. when finished, swayaway terminates.
79
80*SIGUSR1*
81 immediately enter idle state.
82
83# EXAMPLE
84
85```
86swayaway -w \\
87 timeout 300 'swaylock -f -c 000000' \\
88 timeout 600 'swaymsg "output * power off"' \\
89 resume 'swaymsg "output * power on"' \\
90 before-sleep 'swaylock -f -c 000000'
91```
92
93this 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.
94
95to 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.
96
97# SEE ALSO
98
99*sway*(5) *swaymsg*(1) *sway-input*(5) *sway-output*(5) *sway-bar*(5) *loginctl*(1)