{ pkgs, config, lib, ... }: let cfg = config.py.services.swayidle; in { options.py.services.swayidle.enable = lib.mkEnableOption "swayidle"; config.services.swayidle = lib.mkIf cfg.enable { enable = true; events = [ { event = "lock"; command = "${pkgs.swaylock}/bin/swaylock -C ~/.config/swaylock/config"; } { event = "after-resume"; command = ''swaymsg "output * dpms on"''; } ]; timeouts = [ { timeout = 180; command = "${pkgs.swaylock}/bin/swaylock -C ~/.config/swaylock/config"; } ]; }; }