guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: services: Improve the upower-service-type.


From: guix-commits
Subject: 02/03: services: Improve the upower-service-type.
Date: Sat, 16 Feb 2019 17:15:06 -0500 (EST)

cbaines pushed a commit to branch master
in repository guix.

commit 8b9a7b26c290228223829f842240f3675a87da7b
Author: Christopher Baines <address@hidden>
Date:   Tue Jan 29 15:14:15 2019 +0000

    services: Improve the upower-service-type.
    
    Add a description and default value. Switch the documentation to mention the
    service-type and the configuration record, rather than the upower-service
    procedure.
    
    * gnu/services/desktop.scm (upower-service-type)[description, 
default-value]:
    Define these fields.
    (%desktop-services): Change (upower-service) to (service 
upower-service-type).
    * doc/guix.texi (Desktop Services): Update the upower service documentation.
---
 doc/guix.texi            | 92 ++++++++++++++++++++++++++++++++++++++----------
 gnu/services/desktop.scm | 10 ++++--
 2 files changed, 82 insertions(+), 20 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 68d39ed..ddd3adf 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -34,6 +34,7 @@ Copyright @copyright{} 2016, 2017 Nils address@hidden
 Copyright @copyright{} 2016, 2017, 2018 Jan address@hidden
 Copyright @copyright{} 2016 Julien address@hidden
 Copyright @copyright{} 2016 Alex ter address@hidden
+Copyright @copyright{} 2016, 2017, 2018, 2019 Christopher address@hidden
 Copyright @copyright{} 2017, 2018 Clément address@hidden
 Copyright @copyright{} 2017, 2018 Mathieu address@hidden
 Copyright @copyright{} 2017 Federico address@hidden
@@ -14291,24 +14292,79 @@ capabilities to ordinary users.  For example, an 
ordinary user can be granted
 the capability to suspend the system if the user is logged in locally.
 @end deffn
 
address@hidden {Scheme Procedure} upower-service [#:upower @var{upower}] @
-                         [#:watts-up-pro? #f] @
-                         [#:poll-batteries? #t] @
-                         [#:ignore-lid? #f] @
-                         [#:use-percentage-for-policy? #f] @
-                         [#:percentage-low 10] @
-                         [#:percentage-critical 3] @
-                         [#:percentage-action 2] @
-                         [#:time-low 1200] @
-                         [#:time-critical 300] @
-                         [#:time-action 120] @
-                         [#:critical-power-action 'hybrid-sleep]
-Return a service that runs @uref{http://upower.freedesktop.org/,
address@hidden, a system-wide monitor for power consumption and battery
-levels, with the given configuration settings.  It implements the
address@hidden D-Bus interface, and is notably used by
-GNOME.
address@hidden deffn
address@hidden {Scheme Variable} upower-service-type
+Service that runs @uref{http://upower.freedesktop.org/, @command{upowerd}}, a
+system-wide monitor for power consumption and battery levels, with the given
+configuration settings.
+
+It implements the @code{org.freedesktop.UPower} D-Bus interface, and is
+notably used by GNOME.
address@hidden defvr
+
address@hidden {Data Type} upower-configuration
+Data type representation the configuration for UPower.
+
address@hidden @asis
+
address@hidden @code{upower} (default: @var{upower})
+Package to use for @code{upower}.
+
address@hidden @code{watts-up-pro?} (default: @code{#f})
+Enable the Watts Up Pro device.
+
address@hidden @code{poll-batteries?} (default: @code{#t})
+Enable polling the kernel for battery level changes.
+
address@hidden @code{ignore-lid?} (default: @code{#f})
+Ignore the lid state, this can be useful if it's incorrect on a device.
+
address@hidden @code{use-percentage-for-policy?} (default: @code{#f})
+Whether battery percentage based policy should be used.  The default is to use
+the time left, change to @code{#t} to use the percentage.
+
address@hidden @code{percentage-low} (default: @code{10})
+When @code{use-percentage-for-policy?} is @code{#t}, this sets the percentage
+at which the battery is considered low.
+
address@hidden @code{percentage-critical} (default: @code{3})
+When @code{use-percentage-for-policy?} is @code{#t}, this sets the percentage
+at which the battery is considered critical.
+
address@hidden @code{percentage-action} (default: @code{2})
+When @code{use-percentage-for-policy?} is @code{#t}, this sets the percentage
+at which action will be taken.
+
address@hidden @code{time-low} (default: @code{1200})
+When @code{use-time-for-policy?} is @code{#f}, this sets the time remaining in
+seconds at which the battery is considered low.
+
address@hidden @code{time-critical} (default: @code{300})
+When @code{use-time-for-policy?} is @code{#f}, this sets the time remaining in
+seconds at which the battery is considered critical.
+
address@hidden @code{time-action} (default: @code{120})
+When @code{use-time-for-policy?} is @code{#f}, this sets the time remaining in
+seconds at which action will be taken.
+
address@hidden @code{critical-power-action} (default: @code{'hybrid-sleep})
+The action taken when @code{percentage-action} or @code{time-action} is
+reached (depending on the configuration of @code{use-percentage-for-policy?}).
+
+Possible values are:
+
address@hidden @bullet
address@hidden
address@hidden'power-off}
+
address@hidden
address@hidden'hibernate}
+
address@hidden
address@hidden'hybrid-sleep}.
address@hidden itemize
+
address@hidden table
address@hidden deftp
 
 @deffn {Scheme Procedure} udisks-service [#:udisks @var{udisks}]
 Return a service for @uref{http://udisks.freedesktop.org/docs/latest/,
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index df6764d..a4d528f 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -273,6 +273,11 @@ is set to @var{value} when the bus daemon launches it."
 (define upower-service-type
   (let ((upower-package (compose list upower-configuration-upower)))
     (service-type (name 'upower)
+                  (description
+                   "Run @command{upowerd}}, a system-wide monitor for power
+consumption and battery levels, with the given configuration settings.  It
+implements the @code{org.freedesktop.UPower} D-Bus interface, and is notably
+used by GNOME.")
                   (extensions
                    (list (service-extension dbus-root-service-type
                                             upower-dbus-service)
@@ -285,7 +290,8 @@ is set to @var{value} when the bus daemon launches it."
 
                          ;; Make the 'upower' command visible.
                          (service-extension profile-service-type
-                                            upower-package))))))
+                                            upower-package)))
+                  (default-value (upower-configuration)))))
 
 (define* (upower-service #:key (upower upower)
                          (watts-up-pro? #f)
@@ -1029,7 +1035,7 @@ as expected.")))
          (service wpa-supplicant-service-type)    ;needed by NetworkManager
          (service avahi-service-type)
          (udisks-service)
-         (upower-service)
+         (service upower-service-type)
          (accountsservice-service)
          (service cups-pk-helper-service-type)
          (colord-service)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]