From patchwork Tue Jan 29 15:37:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 916 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 9954A16AFF; Tue, 29 Jan 2019 16:00:52 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,UNPARSEABLE_RELAY, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id EC50616AF9 for ; Tue, 29 Jan 2019 16:00:51 +0000 (GMT) Received: from localhost ([127.0.0.1]:51575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goVoh-0006A5-4j for patchwork@mira.cbaines.net; Tue, 29 Jan 2019 11:00:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34011) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goVh5-0006ZI-Qc for guix-patches@gnu.org; Tue, 29 Jan 2019 10:53:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goVSd-000073-7J for guix-patches@gnu.org; Tue, 29 Jan 2019 10:38:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:51434) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1goVSd-00006x-3c for guix-patches@gnu.org; Tue, 29 Jan 2019 10:38:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1goVSc-0003Xu-VZ for guix-patches@gnu.org; Tue, 29 Jan 2019 10:38:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#34246] [PATCH 1/3] services: Improve the upower-configuration record. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Jan 2019 15:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34246 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34246@debbugs.gnu.org Received: via spool by 34246-submit@debbugs.gnu.org id=B34246.154877627313600 (code B ref 34246); Tue, 29 Jan 2019 15:38:02 +0000 Received: (at 34246) by debbugs.gnu.org; 29 Jan 2019 15:37:53 +0000 Received: from localhost ([127.0.0.1]:50713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1goVST-0003XD-5K for submit@debbugs.gnu.org; Tue, 29 Jan 2019 10:37:53 -0500 Received: from li622-129.members.linode.com ([212.71.249.129]:60118 helo=mira.cbaines.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1goVSQ-0003Wk-LC for 34246@debbugs.gnu.org; Tue, 29 Jan 2019 10:37:51 -0500 Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net [86.27.34.15]) by mira.cbaines.net (Postfix) with ESMTPSA id 7E86816AF9 for <34246@debbugs.gnu.org>; Tue, 29 Jan 2019 15:37:49 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 48b3ab70 for <34246@debbugs.gnu.org>; Tue, 29 Jan 2019 15:37:49 +0000 (UTC) From: Christopher Baines Date: Tue, 29 Jan 2019 15:37:47 +0000 Message-Id: <20190129153749.10830-1-mail@cbaines.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <877eenqy8f.fsf@cbaines.net> References: <877eenqy8f.fsf@cbaines.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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 Copy the defaults from the upower-service procedure to the record type. This will allow making it the default value for the upower-service-type, and deprecating the procedure. Export the field accessors so that the record type becomes more usable. * gnu/services/desktop.scm (): Export it. (upower-configuration-upower, upower-configuration-watts-up-pro?, upower-configuration-poll-batteries?, upower-configuration-ignore-lid?, upower-configuration-use-percentage-for-policy?, upower-configuration-percentage-low, upower-configuration-percentage-critical, upower-configuration-percentage-action, upower-configuration-time-low, upower-configuration-time-critical, upower-configuration-time-action, upower-configuration-critical-power-action): Add default and export. --- gnu/services/desktop.scm | 55 +++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index fbeabf1162..f51ac4d74c 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2017 Nils Gillmann ;;; Copyright © 2018 Efraim Flashner ;;; Copyright © 2018 Ricardo Wurmus +;;; Copyright © 2017, 2019 Christopher Baines ;;; ;;; This file is part of GNU Guix. ;;; @@ -56,8 +57,22 @@ #:use-module (guix gexp) #:use-module (srfi srfi-1) #:use-module (ice-9 match) - #:export (upower-configuration + #:export ( + upower-configuration upower-configuration? + upower-configuration-upower + upower-configuration-watts-up-pro? + upower-configuration-poll-batteries? + upower-configuration-ignore-lid? + upower-configuration-use-percentage-for-policy? + upower-configuration-percentage-low + upower-configuration-percentage-critical + upower-configuration-percentage-action + upower-configuration-time-low + upower-configuration-time-critical + upower-configuration-time-action + upower-configuration-critical-power-action + upower-service upower-service-type @@ -173,23 +188,33 @@ is set to @var{value} when the bus daemon launches it." ;;; Upower D-Bus service. ;;; -;; TODO: Export. (define-record-type* upower-configuration make-upower-configuration upower-configuration? - (upower upower-configuration-upower - (default upower)) - (watts-up-pro? upower-configuration-watts-up-pro?) - (poll-batteries? upower-configuration-poll-batteries?) - (ignore-lid? upower-configuration-ignore-lid?) - (use-percentage-for-policy? upower-configuration-use-percentage-for-policy?) - (percentage-low upower-configuration-percentage-low) - (percentage-critical upower-configuration-percentage-critical) - (percentage-action upower-configuration-percentage-action) - (time-low upower-configuration-time-low) - (time-critical upower-configuration-time-critical) - (time-action upower-configuration-time-action) - (critical-power-action upower-configuration-critical-power-action)) + (upower upower-configuration-upower + (default upower)) + (watts-up-pro? upower-configuration-watts-up-pro? + (default #f)) + (poll-batteries? upower-configuration-poll-batteries? + (default #t)) + (ignore-lid? upower-configuration-ignore-lid? + (default #f)) + (use-percentage-for-policy? upower-configuration-use-percentage-for-policy? + (default #f)) + (percentage-low upower-configuration-percentage-low + (default 10)) + (percentage-critical upower-configuration-percentage-critical + (default 3)) + (percentage-action upower-configuration-percentage-action + (default 2)) + (time-low upower-configuration-time-low + (default 1200)) + (time-critical upower-configuration-time-critical + (default 300)) + (time-action upower-configuration-time-action + (default 120)) + (critical-power-action upower-configuration-critical-power-action + (default 'hybrid-sleep))) (define* upower-configuration-file ;; Return an upower-daemon configuration file.