diff --git a/doc/guix.texi b/doc/guix.texi index 0e1e253b02..fcaf6b3fbb 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24996,6 +24996,12 @@ Data type representing the configuration of @command{elogind}. @item @code{hybrid-sleep-mode} (default: @code{'("suspend" "platform" "shutdown")}) (type: list) ... +@item @code{hibernate-delay-seconds} (default: @code{*unspecified*}) (type: integer) +... + +@item @code{suspend-estimation-seconds} (default: @code{*unspecified*}) (type: integer) +... + @end table @end deftp diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 63e2011ce3..9c4d2a1822 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -1080,7 +1080,11 @@ (define-record-type* elogind-configuration (default '("disk"))) (hybrid-sleep-mode elogind-hybrid-sleep-mode (default - '("suspend" "platform" "shutdown")))) + '("suspend" "platform" "shutdown"))) + (hibernate-delay-seconds elogind-hibernate-delay-seconds + (default *unspecified*)) + (suspend-estimation-seconds elogind-suspend-estimation-seconds + (default *unspecified*))) (define (elogind-configuration-file config) (define (yesno x) @@ -1104,8 +1108,11 @@ (define (non-negative-integer x) (unless (exact-integer? x) (error "not an integer" x)) (when (negative? x) (error "negative number not allowed" x)) (number->string x)) + (define (maybe-non-negative-integer x) + (or (and (unspecified? x) x) + (non-negative-integer x))) (define handle-actions - '(ignore poweroff reboot halt kexec suspend hibernate hybrid-sleep lock)) + '(ignore poweroff reboot halt kexec suspend hibernate hybrid-sleep suspend-then-hibernate lock)) (define (handle-action x) (if (unspecified? x) x ;let the unspecified value go through @@ -1163,7 +1170,9 @@ (define-syntax-rule (ini-file config file clause ...) ("HibernateState" (sleep-list elogind-hibernate-state)) ("HibernateMode" (sleep-list elogind-hibernate-mode)) ("HybridSleepState" (sleep-list elogind-hybrid-sleep-state)) - ("HybridSleepMode" (sleep-list elogind-hybrid-sleep-mode)))) + ("HybridSleepMode" (sleep-list elogind-hybrid-sleep-mode)) + ("HibernateDelaySec" (maybe-non-negative-integer elogind-hibernate-delay-seconds)) + ("SuspendEstimationSec" (maybe-non-negative-integer elogind-suspend-estimation-seconds)))) (define (elogind-dbus-service config) "Return a @file{org.freedesktop.login1.service} file that tells D-Bus how to