nixos-config/home/hyprlock_idle.nix

50 lines
1.2 KiB
Nix

{pkgs, lib, super-config, ...}: {
services.hyprpolkitagent.enable = true;
programs.hyprlock.enable = true;
services.hypridle = lib.optionals (super-config.enableHypridle == true) {
enable = true;
settings = let
idle_timeout = "300"; # 5 minutes
screen_timeout = "600"; # 10 minutes
suspend_timeout = "900"; # 10 minutes
lock_cmd = "${pkgs.procps}/bin/pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
suspend_cmd = "systemctl suspend";
in{
general = {
inherit lock_cmd;
before_sleep_cmd = "loginctl lock-session";
};
listener = [
{
timeout = idle_timeout;
on-timeout = "loginctl lock-session";
}
{
timeout = screen_timeout;
on-timeout = "{pkgs.sway}/bin/swaymsg 'output * dpms off'";
on-resume = "{pkgs.sway}/bin/swaymsg 'output * dpms on'";
}
{
timeout = suspend_timeout;
on-timeout = suspend_cmd;
}
];
};
};
home.packages = with pkgs; [
hyprlock
] ++ (lib.optionals (super-config.enableHypridle == true) [
hypridle
]);
xdg.configFile."hypr/hyprlock.conf" = {
source = "${pkgs.dotfiles}/.config/hypr/hyprlock.conf";
};
}