From 6af7d2b52f6338e8b606394ca6f4d239d781d832 Mon Sep 17 00:00:00 2001 From: iFargle Date: Wed, 30 Aug 2023 08:28:18 +0900 Subject: [PATCH] Testing suspend-then-hibernate --- .../desktops/hyprland/gruvbox/hyprland-conf.nix | 2 +- nixos/common/desktops/hyprland/default.nix | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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