From 23febc1d6ad22c779fd3f3a94d41dd8a005803e9 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Tue, 30 Jul 2024 16:04:34 -0400 Subject: [PATCH] move sway/hyprland autoSuspend settings to desktop module --- .../desktop/hyprland/scripts.nix | 2 +- homeManagerModules/desktop/sway/scripts.nix | 2 +- homeManagerModules/options.nix | 18 ++++++------------ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/homeManagerModules/desktop/hyprland/scripts.nix b/homeManagerModules/desktop/hyprland/scripts.nix index 802023bf..04e9210e 100644 --- a/homeManagerModules/desktop/hyprland/scripts.nix +++ b/homeManagerModules/desktop/hyprland/scripts.nix @@ -39,7 +39,7 @@ in { ); beforeSleeps = - lib.optionals cfg.desktop.hyprland.autoSuspend + lib.optionals cfg.desktop.autoSuspend [ "before-sleep '${lib.getExe pkgs.playerctl} pause'" "before-sleep '${lib.getExe pkgs.swaylock}'" diff --git a/homeManagerModules/desktop/sway/scripts.nix b/homeManagerModules/desktop/sway/scripts.nix index 22652920..b49061ef 100644 --- a/homeManagerModules/desktop/sway/scripts.nix +++ b/homeManagerModules/desktop/sway/scripts.nix @@ -20,7 +20,7 @@ in { ); beforeSleeps = - lib.optionals cfg.desktop.sway.autoSuspend + lib.optionals cfg.desktop.autoSuspend [ "before-sleep '${lib.getExe pkgs.playerctl} pause'" "before-sleep '${lib.getExe pkgs.swaylock}'" diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index e6fb3754..53fb338e 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -107,6 +107,12 @@ in { }; desktop = { + autoSuspend = lib.mkOption { + description = "Whether to autosuspend on idle."; + default = cfg.desktop.hyprland.enable || cfg.desktop.sway.enable; + type = lib.types.bool; + }; + hyprland = { enable = lib.mkOption { description = "Hyprland with full desktop session components."; @@ -114,12 +120,6 @@ in { type = lib.types.bool; }; - autoSuspend = lib.mkOption { - description = "Whether to autosuspend on idle."; - default = cfg.desktop.hyprland.enable; - type = lib.types.bool; - }; - laptopMonitors = lib.mkOption { description = "List of internal laptop monitors."; default = []; @@ -195,12 +195,6 @@ in { type = lib.types.bool; }; - autoSuspend = lib.mkOption { - description = "Whether to autosuspend on idle."; - default = cfg.desktop.sway.enable; - type = lib.types.bool; - }; - randomWallpaper = lib.mkOption { description = "Whether to enable random wallpaper script."; default = cfg.desktop.sway.enable;