dotfiles/modules/home/services/swayidle/default.nix

41 lines
807 B
Nix
Raw Permalink Normal View History

2024-08-03 15:15:19 +00:00
{
config,
pkgs,
lib,
namespace,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.${namespace}.services.swayidle;
in {
options.${namespace}.services.swayidle = {
enable = mkEnableOption "swayidle";
};
config = mkIf cfg.enable {
home.packages = [pkgs.swayidle];
services.swayidle = {
enable = true;
timeouts = [
{
timeout = 300;
command = "${pkgs.swaylock}/bin/swaylock";
}
{
timeout = 600;
command = "${pkgs.sway}/bin/swaymsg 'output * dpms off'";
resumeCommand = "${pkgs.sway}/bin/swaymsg 'output * dpms on'";
}
];
events = [
{
event = "before-sleep";
command = "${pkgs.swaylock}/bin/swaylock";
}
];
};
};
}