From d9b2a5158902ac783754250dcf9c52b500d6de7d Mon Sep 17 00:00:00 2001 From: Sergei Bulavintsev Date: Tue, 27 Feb 2024 17:45:57 +0300 Subject: [PATCH] feat(nix): switch to hypridle --- nix/homes/x86_64-linux/sab@nz/default.nix | 2 +- .../home/desktop/addons/hypridle/default.nix | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/nix/homes/x86_64-linux/sab@nz/default.nix b/nix/homes/x86_64-linux/sab@nz/default.nix index 706c7ef..7eb8e1d 100644 --- a/nix/homes/x86_64-linux/sab@nz/default.nix +++ b/nix/homes/x86_64-linux/sab@nz/default.nix @@ -21,7 +21,7 @@ with lib.custom; { rofi = enabled; kitty = disabled; swaylock = enabled; - swayidle = enabled; + hypridle = enabled; waybar = enabled; wlogout = enabled; hyprlock = disabled; diff --git a/nix/modules/home/desktop/addons/hypridle/default.nix b/nix/modules/home/desktop/addons/hypridle/default.nix index 3d19832..d8c287d 100644 --- a/nix/modules/home/desktop/addons/hypridle/default.nix +++ b/nix/modules/home/desktop/addons/hypridle/default.nix @@ -20,21 +20,27 @@ in { config = mkIf cfg.enable { services.hypridle = { enable = true; - package = pkgs.hypridle; + # package = pkgs.hypridle; - lockCmd = "${getExe config.programs.hypridle.package}"; + lockCmd = "${pkgs.swaylock-effects}/bin/swaylock -fF"; afterSleepCmd = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms on"; + # 5 min lock, 10min turn the screen off, 20 min suspend listeners = [ { - timeout = 900; - onTimeout = "${getExe config.programs.hypridle.package}"; + timeout = 300; + onTimeout = "${pkgs.swaylock-effects}/bin/swaylock -fF"; } { - timeout = 1200; + timeout = 600; onTimeout = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms off"; onResume = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms on"; } + { + timeout = 1200; + onTimeout = "${pkgs.systemd}/bin/systemctl suspend"; + onResume = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms on"; + } ]; }; };