With swayidle one can configure two different kinds of hooks:
- Idle timeouts are executed after the session has been idle for a
specific amount of time.
- Events are executed when systemd notifies us that for example the
user session is locked or that the device is about to suspend.
While not obvious, there is a significant difference between how these
two kinds are configured: there can be several timeouts with separate
commands to be executed, but each event can only be specified once. If
an event is specified multiple times, then the last command wins.
This can be very easy to miss in swayidle's documentation. Furthermore,
because the config is a list of `{ event = "..."; command = "..."; }`
attrset, we double down on this confusion and make it seem like having
multiple handlers for an event was actually supported.
Fix this by converting from a list of "event" submodules to an attrset
where the key is the event name and the value is the command to be
executed. This makes it impossible to specify multiple commands for a
single event by accident.
If a user _does_ want to have multiple commands executed on any event
they can for example use `pkgs.writeShellScript` and manually chain the
commands in that script.
Instead of having to manually stub packages that should not be
downloaded we instead automatically stub all packages (except a small
list of whitelisted ones). Tests can re-introduce the real package by
using the `realPkgs` module argument.
Occasionally, swayidle crashes with a failure to connect to the
Wayland session. Ideally, swayidle should automatically restart
instead of leaving the system in a vulnerable state.
swayidle executes commands using "sh -c" and so its PATH must contain
a shell. This adds such PATH entry to the environment of the systemd
service.
Fixes#2811.
Swayidle is an idle management daemon for Wayland. This modules adds support for
running swayidle as a SystemD user unit and makes it configurable through
home-manager.