From: Morgan Smith <Morgan.J.Smith@outlook.com>
To: 72504@debbugs.gnu.org
Cc: "Morgan Smith" <Morgan.J.Smith@outlook.com>,
"Florian Pelz" <pelzflorian@pelzflorian.de>,
"Ludovic Courtès" <ludo@gnu.org>,
"Matthew Trzcinski" <matt@excalamus.com>,
"Maxim Cournoyer" <maxim.cournoyer@gmail.com>
Subject: [bug#72504] [PATCH] services: elogind-configuration: Add more sleep configurations
Date: Tue, 6 Aug 2024 21:51:37 -0400 [thread overview]
Message-ID: <CH3PR84MB34247055D905C5F8E19656A7C5B82@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM> (raw)
* 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
next reply other threads:[~2024-08-07 1:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 1:51 Morgan Smith [this message]
2024-08-15 15:15 ` [bug#72504] QA review for 72504 Nicolas Graves via Guix-patches via
2024-08-21 16:59 ` bug#72504: [PATCH] services: elogind-configuration: Add more sleep configurations Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CH3PR84MB34247055D905C5F8E19656A7C5B82@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM \
--to=morgan.j.smith@outlook.com \
--cc=72504@debbugs.gnu.org \
--cc=ludo@gnu.org \
--cc=matt@excalamus.com \
--cc=maxim.cournoyer@gmail.com \
--cc=pelzflorian@pelzflorian.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.