{ config, ... }: let swaylock = "${config.programs.swaylock.package}/bin/swaylock"; in { services.swayidle = { enable = true; systemdTarget = "graphical-session.target"; events = [ { event = "before-sleep"; command = "${swaylock} --daemonize"; } ]; timeouts = [ { timeout = 4 * 60; command = "${swaylock} --daemonize --grace 15"; } ]; }; }