GNU bug report logs - #72504
[PATCH] services: elogind-configuration: Add more sleep configurations

Previous Next

Package: guix-patches;

Reported by: Morgan Smith <Morgan.J.Smith <at> outlook.com>

Date: Wed, 7 Aug 2024 02:00:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72504 in the body.
You can then email your comments to 72504 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, matt <at> excalamus.com, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org:
bug#72504; Package guix-patches. (Wed, 07 Aug 2024 02:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Morgan Smith <Morgan.J.Smith <at> outlook.com>:
New bug report received and forwarded. Copy sent to pelzflorian <at> pelzflorian.de, ludo <at> gnu.org, matt <at> excalamus.com, maxim.cournoyer <at> gmail.com, guix-patches <at> gnu.org. (Wed, 07 Aug 2024 02:00:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: guix-patches <at> gnu.org
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Subject: [PATCH] services: elogind-configuration: Add more sleep configurations
Date: Tue,  6 Aug 2024 21:51:37 -0400
* gnu/services/desktop.scm (<elogind-configuration>): Allow actions to be set
to 'suspend-then-hibernate'.  Add configuration for 'hibernate-delay-seconds'
and 'suspend-estimation-seconds'.

* doc/guix.texi (Desktop Services): Add documentation for
'hibernate-delay-seconds' and 'suspend-estimation-seconds'.

Change-Id: Icf788fcc88451aa6174a608fbed309961b847430
---

This patch exists so I can use and configure the suspend-then-hibernate action
of elogind.  This will save me the frustration of having my laptop battery die
in my backpack.

I tested that this produces the correct configurations.

 doc/guix.texi            |  6 ++++++
 gnu/services/desktop.scm | 15 ++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index b7eb8fd346..92ce8c2268 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -24986,6 +24986,12 @@ Desktop Services
 @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> 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 (elogind-configuration-file config)
     (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 (elogind-configuration-file config)
    ("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
-- 
2.45.2





Information forwarded to guix-patches <at> gnu.org:
bug#72504; Package guix-patches. (Thu, 15 Aug 2024 15:17:03 GMT) Full text and rfc822 format available.

Message #8 received at 72504 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: control <at> debbugs.gnu.org,72504 <at> debbugs.gnu.org
Subject: QA review for 72504
Date: Thu, 15 Aug 2024 17:15:39 +0200
user guix
usertag 72504 + reviewed-looks-good
thanks

Guix QA review form submission:
LGTM. No service test associed yet to elogind so cannot be tested
against a mock configuration.

Items marked as checked: Lint warnings, Package builds, Commit messages

-- 
Best regards,
Nicolas Graves




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 21 Aug 2024 17:01:01 GMT) Full text and rfc822 format available.

Notification sent to Morgan Smith <Morgan.J.Smith <at> outlook.com>:
bug acknowledged by developer. (Wed, 21 Aug 2024 17:01:02 GMT) Full text and rfc822 format available.

Message #13 received at 72504-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, 72504-done <at> debbugs.gnu.org,
 Matthew Trzcinski <matt <at> excalamus.com>,
 Florian Pelz <pelzflorian <at> pelzflorian.de>
Subject: Re: [bug#72504] [PATCH] services: elogind-configuration: Add more
 sleep configurations
Date: Wed, 21 Aug 2024 18:59:48 +0200
Morgan Smith <Morgan.J.Smith <at> outlook.com> skribis:

> * gnu/services/desktop.scm (<elogind-configuration>): Allow actions to be set
> to 'suspend-then-hibernate'.  Add configuration for 'hibernate-delay-seconds'
> and 'suspend-estimation-seconds'.
>
> * doc/guix.texi (Desktop Services): Add documentation for
> 'hibernate-delay-seconds' and 'suspend-estimation-seconds'.
>
> Change-Id: Icf788fcc88451aa6174a608fbed309961b847430

Applied, thanks!  (And thank you, Nicolas!)

> This patch exists so I can use and configure the suspend-then-hibernate action
> of elogind.  This will save me the frustration of having my laptop battery die
> in my backpack.

Makes sense.  :-)

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 19 Sep 2024 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 275 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.