configuration.nix/home/wm/addon/hypridle.nix

45 lines
1.4 KiB
Nix
Raw Normal View History

2024-05-12 21:42:10 +05:30
{ config, pkgs, ... }:
let
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl";
lock-session = "${pkgs.systemd}/bin/loginctl lock-session";
in
{
2024-05-12 19:06:03 +05:30
services.hypridle = {
enable = true;
settings = {
2024-05-12 21:42:10 +05:30
general = {
lock_cmd = "${pkgs.procps}/bin/pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
2024-05-12 21:42:10 +05:30
unlock_cmd = "${pkgs.procps}/bin/pkill -USR1 hyprlock";
before_sleep_cmd = lock-session;
after_sleep_cmd = "${hyprctl} dispatch dpms on";
};
listener = [
{
2024-05-18 15:05:56 +05:30
timeout = 10;
2024-05-18 16:37:32 +05:30
on-timeout = "${brightnessctl} --quiet --device=dell::kbd_backlight --save set 0";
on-resume = "${brightnessctl} --quiet --device=dell::kbd_backlight --restore";
2024-05-12 21:42:10 +05:30
}
{
2024-05-18 15:05:56 +05:30
timeout = 150;
2024-05-18 16:37:32 +05:30
on-timeout = "${brightnessctl} --quiet --device=intel_backlight --save set 30";
on-resume = "${brightnessctl} --quiet --device=intel_backlight --restore";
2024-05-18 15:05:56 +05:30
}
{
timeout = 300;
2024-05-12 21:42:10 +05:30
on-timeout = lock-session;
}
{
2024-05-18 15:05:56 +05:30
timeout = 420;
2024-05-12 21:42:10 +05:30
on-timeout = "${hyprctl} dispatch dpms off";
on-resume = "${hyprctl} dispatch dpms on";
}
{
2024-05-18 15:05:56 +05:30
timeout = 600;
2024-05-12 21:42:10 +05:30
on-timeout = "${pkgs.systemd}/bin/systemctl suspend";
}
];
2024-05-12 19:06:03 +05:30
};
};
}