diff --git a/homeManagerModules/desktop/hypr/default.nix b/homeManagerModules/desktop/hypr/default.nix index 4b1d707f..29086c0a 100644 --- a/homeManagerModules/desktop/hypr/default.nix +++ b/homeManagerModules/desktop/hypr/default.nix @@ -11,6 +11,11 @@ options = { alyraffauf.desktop.hyprland.enable = lib.mkEnableOption "Enables hyprland with extra apps."; + alyraffauf.desktop.hyprland.autoSuspend = lib.mkOption { + description = "Whether to autosuspend on idle."; + default = true; + type = lib.types.bool; + }; }; config = lib.mkIf config.alyraffauf.desktop.hyprland.enable { @@ -94,11 +99,14 @@ lock = pkgs.swaylock + ''/bin/swaylock -l -f -c 303446 --indicator-idle-visible --font "Noto SansM Nerd Font Regular" --ring-color ca9ee6 --inside-color 303446''; idled = - if osConfig.networking.hostName == "mauville" - then ''${pkgs.swayidle}/bin/swayidle -w timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' resume '${pkgs.brightnessctl}/bin/brightnessctl -r' timeout 300 '${lock}' timeout 330 '${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off' resume '${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off' before-sleep '${lock}' + if config.alyraffauf.desktop.hyprland.autoSuspend + then '' + ${pkgs.swayidle}/bin/swayidle -w timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' resume '${pkgs.brightnessctl}/bin/brightnessctl -r' timeout 300 '${lock}' timeout 330 '${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off' resume '${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off' timeout 900 '${pkgs.systemd}/bin/systemctl suspend' before-sleep '${lock}' + '' else '' - ${pkgs.swayidle}/bin/swayidle -w timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' resume '${pkgs.brightnessctl}/bin/brightnessctl -r' timeout 300 '${lock}' timeout 330 '${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off' resume '${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off' timeout 900 '${pkgs.systemd}/bin/systemctl suspend' before-sleep '${lock}' + ${pkgs.swayidle}/bin/swayidle -w timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' resume '${pkgs.brightnessctl}/bin/brightnessctl -r' timeout 300 '${lock}' timeout 330 '${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off' resume '${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off' before-sleep '${lock}' + ''; hyprnome = pkgs.hyprnome + "/bin/hyprnome"; diff --git a/homeManagerModules/desktop/sway/default.nix b/homeManagerModules/desktop/sway/default.nix index ebd098c6..98ea464b 100644 --- a/homeManagerModules/desktop/sway/default.nix +++ b/homeManagerModules/desktop/sway/default.nix @@ -8,6 +8,11 @@ imports = [./randomWallpaper.nix]; options = { alyraffauf.desktop.sway.enable = lib.mkEnableOption "Sway with extra apps."; + alyraffauf.desktop.sway.autoSuspend = lib.mkOption { + description = "Whether to autosuspend on idle."; + default = true; + type = lib.types.bool; + }; }; config = lib.mkIf config.alyraffauf.desktop.sway.enable { @@ -78,7 +83,7 @@ logout = pkgs.wlogout + "/bin/wlogout"; lock = pkgs.swaylock + ''/bin/swaylock -l -f -c 303446 --indicator-idle-visible --font "Noto SansM Nerd Font Regular" --ring-color ca9ee6 --inside-color 303446''; idled = - if osConfig.networking.hostName == "mauville" + if config.alyraffauf.desktop.sway.autoSuspend then '' ${pkgs.swayidle}/bin/swayidle -w \ timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' \ @@ -86,6 +91,7 @@ timeout 300 '${lock}' \ timeout 330 '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms off"' \ resume '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms on"' \ + timeout 900 '${pkgs.systemd}/bin/systemctl suspend' \ before-sleep '${lock}' '' else '' @@ -95,7 +101,6 @@ timeout 300 '${lock}' \ timeout 330 '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms off"' \ resume '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms on"' \ - timeout 900 '${pkgs.systemd}/bin/systemctl suspend' \ before-sleep '${lock}' ''; diff --git a/hosts/mauville/home.nix b/hosts/mauville/home.nix index 58f43dfb..70882432 100644 --- a/hosts/mauville/home.nix +++ b/hosts/mauville/home.nix @@ -9,5 +9,7 @@ imports = [../../homeManagerModules ../../aly.nix]; xdg.userDirs.music = "/mnt/Media/Music"; home.stateVersion = "23.11"; + alyraffauf.desktop.hyprland.autoSuspend = false; + alyraffauf.desktop.sway.autoSuspend = false; }; }