From 6e91950e14a01d6543a09439cb7a22fd44073473 Mon Sep 17 00:00:00 2001 From: joy Date: Sun, 1 Sep 2024 19:10:52 +0200 Subject: [PATCH] libconfig for hypridle --- hosts/laptop/default.nix | 3 ++- modules/hypr/hypridle/default.nix | 39 ++++++++++++++++++------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix index 341eb22..859f1f1 100644 --- a/hosts/laptop/default.nix +++ b/hosts/laptop/default.nix @@ -1,6 +1,5 @@ { inputs, - pkgs, ... }: { networking.hostName = "laptop"; @@ -8,6 +7,8 @@ boot.loader.systemd-boot.enable = true; services.xserver.desktopManager.gnome.enable = true; + hypridle.enable = true; + imports = [ ../../modules ./hardware.nix diff --git a/modules/hypr/hypridle/default.nix b/modules/hypr/hypridle/default.nix index 728181b..e2c67f7 100644 --- a/modules/hypr/hypridle/default.nix +++ b/modules/hypr/hypridle/default.nix @@ -1,19 +1,26 @@ -{...}: { - home-manager.users.joy.services.hypridle = { - enable = true; - settings = { - listener = [ - { - timeout = 300; - on-timeout = "hyprctl dispatch dpms off"; - on-resume = "hyprctl dispatch dpms on"; - } - { - timeout = 600; - on-timeout = "systemctl suspend"; - on-resume = "hyprctl dispatch dpms on"; - } - ]; +{lib,config,...}: { + options = { + hypridle.enable = lib.mkEnableOption "Enables kitty"; + }; + + config = lib.mkIf config.hypridle.enable { + home-manager.users.joy.services.hypridle = { + enable = true; + settings = { + listener = [ + { + timeout = 300; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + { + timeout = 600; + on-timeout = "systemctl suspend"; + on-resume = "hyprctl dispatch dpms on"; + } + ]; + }; }; }; + }