34 lines
606 B
Nix
34 lines
606 B
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
lib.mkIf config.services.swayidle.enable {
|
|
services.swayidle =
|
|
let
|
|
locker = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
|
|
in
|
|
{
|
|
events = [
|
|
{
|
|
event = "before-sleep";
|
|
command = locker;
|
|
}
|
|
{
|
|
event = "lock";
|
|
command = locker;
|
|
}
|
|
];
|
|
timeouts = [
|
|
{
|
|
timeout = 300;
|
|
command = "loginctl lock-session";
|
|
}
|
|
{
|
|
timeout = 1200;
|
|
command = "${pkgs.systemd}/bin/systemctl hibernate";
|
|
}
|
|
];
|
|
};
|
|
}
|