diff --git a/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/hyprland-conf.nix b/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/hyprland-conf.nix index d5970ed1..a2d248a9 100644 --- a/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/hyprland-conf.nix +++ b/home-manager/hosts/nixos-laptop/desktops/hyprland/gruvbox/hyprland-conf.nix @@ -264,7 +264,7 @@ swayidle -w \ timeout 120 'swaylock -f' \ timeout 180 'hyprctl dispatch dpms off' \ - timeout 300 'systemctl suspend' \ + timeout 300 'systemctl suspend-then-hibernate' \ resume 'hyprctl dispatch dpms on' \ before-sleep 'swaylock -f' \ before-sleep 'playerctl pause' diff --git a/nixos/common/desktops/hyprland/default.nix b/nixos/common/desktops/hyprland/default.nix index bdf11e96..3a4fff0d 100644 --- a/nixos/common/desktops/hyprland/default.nix +++ b/nixos/common/desktops/hyprland/default.nix @@ -46,11 +46,19 @@ NIXOS_OZONE_WL = "1"; }; + # https://www.freedesktop.org/software/systemd/man/logind.conf.html services.logind.extraConfig = '' IdleActionSec=900 IdleAction=suspend-then-hibernate + HandleLidSwitch=suspend-then-hibernate + HandleLidSwitchDocked=ignore + HandleLidSwitchExternalPower=suspend ''; + # https://www.systutorials.com/docs/linux/man/5-systemd-sleep.conf/ + # HibernateDelaySec is the amount of time the + # system sleeps before entering hibernate when + # using suspend-then-hibernate systemd.sleep.extraConfig = '' AllowSuspend = yes AllowHibernate = yes