all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 58014@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#58014] [PATCH 14/15] services: xorg: Add auto-suspend? field to <gdm-configuration>.
Date: Fri, 23 Sep 2022 01:00:41 -0400	[thread overview]
Message-ID: <20220923050042.29893-14-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20220923050042.29893-1-maxim.cournoyer@gmail.com>

* gnu/services/xorg.scm (<gdm-configuration>)
<auto-suspend?>: New field.
(gdm-dconf-profiles): New variable.
* gnu/services/xorg.scm (gdm-shepherd-service)
<environment-variables> [!auto-suspend?]: Specify DCONF_PROFILE.
(gdm-service-type): Extend DCONF-SERVICE-TYPE.
* doc/guix.texi (X Window): Document the new field.
---
 doc/guix.texi         |  6 ++++++
 gnu/services/xorg.scm | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index be1f2e0063..b04ec25399 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -21050,6 +21050,12 @@ When @code{auto-login?} is false, GDM presents a log-in screen.
 When @code{auto-login?} is true, GDM logs in directly as
 @code{default-user}.
 
+@item @code{auto-suspend?} (default @code{#t})
+When true, GDM will automatically suspend to RAM when nobody is
+physically connected.  When a machine is used via remote desktop or SSH,
+this should be set to false to avoid GDM interrupting remote sessions or
+rendering the machine unavailable.
+
 @item @code{debug?} (default: @code{#f})
 When true, GDM writes debug messages to its log.
 
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 9205c6f9f4..902fef0058 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -986,6 +986,7 @@ (define-record-type* <gdm-configuration>
   (gdm gdm-configuration-gdm (default gdm))
   (allow-empty-passwords? gdm-configuration-allow-empty-passwords? (default #t))
   (auto-login? gdm-configuration-auto-login? (default #f))
+  (auto-suspend? gdm-configuration-auto-suspend? (default #t))
   (dbus-daemon gdm-configuration-dbus-daemon (default dbus-daemon-wrapper))
   (debug? gdm-configuration-debug? (default #f))
   (default-user gdm-configuration-default-user (default #f))
@@ -1001,6 +1002,30 @@ (define-record-type* <gdm-configuration>
   (wayland-session gdm-configuration-wayland-session
                    (default gdm-wayland-session-wrapper)))
 
+(define (gdm-dconf-profiles config)
+  (if (gdm-configuration-auto-suspend? config)
+      '()
+      ;; This custom gconf profile works around a lack of configuration option
+      ;; to disable auto-suspend when no users are physically logged in (see:
+      ;; https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/22).
+      (list (dconf-profile
+             (name "gdm")
+             (content (list #~(begin
+                                (use-modules (ice-9 textual-ports))
+                                (string-trim
+                                 (call-with-input-file
+                                     #$(file-append gdm "/share/dconf/profile/gdm")
+                                   get-string-all)))
+                            "system-db:gdm"))
+             (keyfile (dconf-keyfile
+                       (name "00-disable-suspend")
+                       (content
+                        (list "[org/gnome/settings-daemon/plugins/power]"
+                              "sleep-inactive-ac-type='nothing'"
+                              "sleep-inactive-battery-type='nothing'"
+                              "sleep-inactive-ac-timeout=0"
+                              "sleep-inactive-battery-timeout=0"))))))))
+
 (define (gdm-configuration-file config)
   (mixed-text-file "gdm-custom.conf"
                    "[daemon]\n"
@@ -1073,7 +1098,10 @@ (define (gdm-shepherd-service config)
                      (list #$(file-append (gdm-configuration-gdm config)
                                           "/bin/gdm"))
                      #:environment-variables
-                     (list (string-append
+                     (list #$@(if (gdm-configuration-auto-suspend? config)
+                                  #~()
+                                  #~("DCONF_PROFILE=/etc/dconf/profile/gdm"))
+                           (string-append
                             "GDM_CUSTOM_CONF="
                             #$(gdm-configuration-file config))
                            (string-append
@@ -1152,6 +1180,8 @@ (define gdm-service-type
                                             gdm-shepherd-service)
                          (service-extension account-service-type
                                             (const %gdm-accounts))
+                         (service-extension dconf-service-type
+                                            gdm-dconf-profiles)
                          (service-extension pam-root-service-type
                                             gdm-pam-service)
                          (service-extension polkit-service-type
-- 
2.37.3





  parent reply	other threads:[~2022-09-23  5:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23  4:58 [bug#58014] [PATCH 00/15] Add xvnc-service-type Maxim Cournoyer
2022-09-23  5:00 ` [bug#58014] [PATCH 01/15] gnu: tigervnc-server: Use new style inputs, gexps Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 02/15] gnu: tigervnc-server: Move source production into origin snippet Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 03/15] gnu: tigervnc-server: Adjust PAM config Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 04/15] gnu: tigervnc-server: Disable tests via #:tests? Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 05/15] gnu: tigervnc-server: Patch and wrap vncserver script Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 06/15] gnu: gdm: Patch an extra reference to the Xsession script Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 07/15] services: gdm: Add a configuration field to enable XDMCP Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 08/15] marionette: Make marionette-screen-text private Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 09/15] marionette: Preserve screen dumps on failures Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 10/15] marionette: Define keystrokes for typing colons and exclamation marks Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 11/15] marionette: Add a callback arguments to wait-for-screen-text Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 12/15] gnu: dconf: Set sysconfdir to /etc Maxim Cournoyer
2022-09-23  5:00   ` [bug#58014] [PATCH 13/15] services: Add dconf-service-type Maxim Cournoyer
2022-09-23  5:00   ` Maxim Cournoyer [this message]
2022-09-23  5:00   ` [bug#58014] [PATCH 15/15] services: Add xvnc-service-type Maxim Cournoyer

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=20220923050042.29893-14-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=58014@debbugs.gnu.org \
    /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.