46 lines
1.1 KiB
Nix
46 lines
1.1 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.wayland.windowManager.hyprland;
|
|
in
|
|
{
|
|
config = lib.mkIf cfg.enable {
|
|
services.hypridle = {
|
|
enable = true;
|
|
settings = {
|
|
general = {
|
|
ignore_dbus_inhibit = false;
|
|
lock_cmd = "pidof hyprlock || ${config.programs.hyprlock.package}/bin/hyprlock";
|
|
before_sleep_cmd = "${pkgs.systemd}/bin/loginctl lock-session";
|
|
after_sleep_cmd = "${cfg.finalPackage}/bin/hyprctl dispatch dpms on";
|
|
};
|
|
|
|
listener = [
|
|
{
|
|
timeout = 8 * 60;
|
|
on-timeout = "${pkgs.libnotify}/bin/notify-send \"You are idle!\"";
|
|
}
|
|
{
|
|
timeout = 10 * 60;
|
|
on-timeout = "${config.programs.hyprlock.package}/bin/hyprlock";
|
|
}
|
|
{
|
|
timeout = 15 * 60;
|
|
on-timeout = "${pkgs.systemd}/bin/systemctl suspend";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
|
|
# TODO - Remove?
|
|
systemd.user.services.hypridle = {
|
|
Unit.After = lib.mkForce "graphical-session.target";
|
|
Service.Slice = "session.slice";
|
|
};
|
|
};
|
|
}
|