From patchwork Fri Sep 23 05:00:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42870 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8951527BBE9; Fri, 23 Sep 2022 06:06:53 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id EBB8827BBF0 for ; Fri, 23 Sep 2022 06:06:49 +0100 (BST) Received: from localhost ([::1]:37644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obatl-0005rz-32 for patchwork@mira.cbaines.net; Fri, 23 Sep 2022 01:06:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obaq6-00040h-SD for guix-patches@gnu.org; Fri, 23 Sep 2022 01:03:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39975) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obaq6-0002Em-IC for guix-patches@gnu.org; Fri, 23 Sep 2022 01:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1obaq6-00057j-C8 for guix-patches@gnu.org; Fri, 23 Sep 2022 01:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58014] [PATCH 14/15] services: xorg: Add auto-suspend? field to . Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 23 Sep 2022 05:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58014 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58014@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 58014-submit@debbugs.gnu.org id=B58014.166390933219632 (code B ref 58014); Fri, 23 Sep 2022 05:03:02 +0000 Received: (at 58014) by debbugs.gnu.org; 23 Sep 2022 05:02:12 +0000 Received: from localhost ([127.0.0.1]:39051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obapI-00056Y-8a for submit@debbugs.gnu.org; Fri, 23 Sep 2022 01:02:12 -0400 Received: from mail-qt1-f180.google.com ([209.85.160.180]:44841) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obapD-00054K-35 for 58014@debbugs.gnu.org; Fri, 23 Sep 2022 01:02:07 -0400 Received: by mail-qt1-f180.google.com with SMTP id f26so7741118qto.11 for <58014@debbugs.gnu.org>; Thu, 22 Sep 2022 22:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=vuq0hriT3+MgMFrP0QkAVley/t4x1B0R+S/83oneL4I=; b=VdcrYqUDwG8KbqsFPCYOwMJvSdx/W/5805kaqQNm25aFyYthv3GahFuFHcU22x5tl/ 2FoOEBrT0ni7/FplwPxadHdiiPSfjC1dzr3g8SaI2dvQv8syOpkJxlO+hGPLKSOMUwmm W6NnOhbMnBzMZg1CF1Qo5KLikUqCayUwV4jOUk+mRnA5hjtfjgY6YGMn3dZOd4hkrm0M Y/pRqXlxOp9xq+brkk9eyB+LaIt8RcB1tOnZU1vl6jILsD3k+g8NHe8xCgPrxbYRe8Y2 2HkH8Aj1mztDBjYLPjyON7LzxOCraxdiYEQbSrYrIeEPPVZAlJ4iUJhE/LPgGn1CjUbc s1UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=vuq0hriT3+MgMFrP0QkAVley/t4x1B0R+S/83oneL4I=; b=ZQZO+3zVqkXRbcdT2nKxTysBlRaq9aio+wXO5yPBf2wJJI/jzS1DY4XjgMHrlHXy66 sPSkiTuPVYeZACCev+ObKE4QRDJytAeF3dslHnvQDUx1m4xCwb+gLtE3vfCfHBdA52FZ srBPX2yTVP34UHk/HoSJmT/9VD3akrzMHCmI/UsefcP0c49vQfi/9GE1pHvQiTd+mLXm aEM2fUJzxBMzYO7U8cl/7g/xW3y/2tPCWPxhHgIM8clhNQm7F/Tl6LeLL1y0dJO1K6pa L0SyklfOS9SSf0nkCUxctB5W1hkq0ze8wD1lHdMN+hAZ8XeeR3MA6s6fIGZSkVp3+htN V/fQ== X-Gm-Message-State: ACrzQf3tYQDBfpfEIT0JzE7DemVjzkWlVK8S4fnKbPWNcr+MC8mFfbUy RV3weBaPU0VjXfJoHkuv3hA95HtkESc= X-Google-Smtp-Source: AMsMyM6vzg1vytYUI3NfeFitCp0PKDdFgwvyYLjcD+dPwLmt7AdeqqNqW9Ws7WY8W51ASmga1uQ9kg== X-Received: by 2002:a05:622a:301:b0:35c:fca2:4641 with SMTP id q1-20020a05622a030100b0035cfca24641mr5807411qtw.206.1663909321397; Thu, 22 Sep 2022 22:02:01 -0700 (PDT) Received: from localhost.localdomain ([2607:fad8:4:3::1001]) by smtp.gmail.com with ESMTPSA id de4-20020a05620a370400b006bbb07ebd83sm5263534qkb.108.2022.09.22.22.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 22:02:01 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 23 Sep 2022 01:00:41 -0400 Message-Id: <20220923050042.29893-14-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923050042.29893-1-maxim.cournoyer@gmail.com> References: <20220923050042.29893-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/xorg.scm () : New field. (gdm-dconf-profiles): New variable. * gnu/services/xorg.scm (gdm-shepherd-service) [!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 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* (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